skalero01 / the-imgur-uploader
该包已废弃,不再维护。未建议替代包。
上传图片,无需imgur账户。在Picasa和Imageshack上也同样有效!
dev-master
2014-12-04 23:08 UTC
Requires
- php: >=5.0
- ptcong/php-cache-manager: dev-master
- ptcong/php-http-class: dev-master
This package is not auto-updated.
Last update: 2017-12-15 12:12:40 UTC
README
本项目帮助远程上传图片到Imgur以及一些其他托管服务,如Picasa、Imageshack、Postimage等。
本项目是Phan Thanh Cong的PHP-Image-Uploader的修复版本。
修复了什么?
- 需要下载另一个包。
- 安装时存在问题
使用方法
如果您使用composer
将require "skalero01/the-imgur-uploader": "dev-master"
添加到 composer.json 并运行 composer update
,
上传到Imgur
$uploader = ChipVN_ImageUploader_Manager::make('Imgur');
$uploader->setApi('your client id');
$uploader->setSecret('your client secret');
// you may upload with anonymous account but may be the image will be deleted after a period of time
// $uploader->login('your account here', 'your password here');
echo $uploader->upload(getcwd(). '/a.jpg');
echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg');
上传到Picasa。
要上传图片到Picasa,您需要一些AlbumIds,否则图片将上传到默认相册。为了更快地创建新的AlbumId,您可以使用echo $uploader->addAlbum('testing 1');
$uploader = ChipVN_ImageUploader_Manager::make('Picasa');
$uploader->login('your account', 'your password');
// you can set upload to an albumId by array of albums or an album, system will get a random album to upload
//$uploader->setAlbumId(array('51652569125195125', '515124156195725'));
//$uploader->setAlbumId('51652569125195125');
echo $uploader->upload(getcwd(). '/test.jpg');
// this plugin does not support transload image
上传到Imageshack
$uploader = ChipVN_ImageUploader_Manager::make('Imageshack');
$uploader->login('your account', 'your password');
$uploader->setApi('your api here');
echo $uploader->upload(getcwd(). '/a.jpg');
echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg');
上传到Postimage
$uploader = ChipVN_ImageUploader_Manager::make('Postimage');
// you may upload with anonymous account but may be the image will be deleted after a period of time
// $uploader->login('your account here', 'your password here');
echo $uploader->upload(getcwd(). '/a.jpg');
echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg');
上传到Flickr
// already exist, update later