|
95 | 95 | To upload image to Picasa, you need to have some AlbumIds otherwise the image will be uploaded to _default_ album.
|
96 | 96 | To create new AlbumId faster, you may use echo `$uploader->addAlbum('testing 1');`
|
97 | 97 |
|
98 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Picasa'); |
99 |
| - $uploader->login('your account', 'your password'); |
100 |
| - // you can set upload to an albumId by array of albums or an album, system will get a random album to upload |
101 |
| - //$uploader->setAlbumId(array('51652569125195125', '515124156195725')); |
102 |
| - //$uploader->setAlbumId('51652569125195125'); |
103 |
| - echo $uploader->upload(getcwd(). '/test.jpg'); |
104 |
| - // this plugin does not support transload image |
| 98 | +```php |
| 99 | +$uploader = ChipVN_ImageUploader_Manager::make('Picasa'); |
| 100 | +$uploader->login('your account', 'your password'); |
| 101 | +// you can set upload to an albumId by array of albums or an album, system will get a random album to upload |
| 102 | +//$uploader->setAlbumId(array('51652569125195125', '515124156195725')); |
| 103 | +//$uploader->setAlbumId('51652569125195125'); |
| 104 | +echo $uploader->upload(getcwd(). '/test.jpg'); |
| 105 | +// this plugin does not support transload image |
| 106 | +``` |
105 | 107 |
|
106 | 108 | ### Upload to Picasanew - ver 2 (use OAuth 2.0)
|
107 | 109 | To upload image to Picasanew, you need to have some AlbumIds otherwise the image will be uploaded to _default_ album.
|
108 | 110 | To create new AlbumId faster, you may use echo `$uploader->addAlbum('testing 1');`
|
109 | 111 |
|
110 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Picasanew'); |
111 |
| - $uploader->login('your user name', ''); // we don't need password here |
112 |
| - $uploader->setApi('Client ID'); // register in console.developers.google.com |
113 |
| - $uploader->setSecret('Client secret'); |
114 |
| - // you can set upload to an albumId by array of albums or an album, system will get a random album to upload |
115 |
| - //$uploader->setAlbumId(array('51652569125195125', '515124156195725')); |
116 |
| - //$uploader->setAlbumId('51652569125195125'); |
117 |
| - if (!$uploader->hasValidToken()) { |
118 |
| - $uploader->getOAuthToken('http://yourdomain.com/test.php'); |
119 |
| - } |
120 |
| - echo $uploader->upload(getcwd(). '/test.jpg'); |
121 |
| - // this plugin does not support transload image |
| 112 | +```php |
| 113 | +$uploader = ChipVN_ImageUploader_Manager::make('Picasanew'); |
| 114 | +$uploader->login('your user name', ''); // we don't need password here |
| 115 | +$uploader->setApi('Client ID'); // register in console.developers.google.com |
| 116 | +$uploader->setSecret('Client secret'); |
| 117 | +// you can set upload to an albumId by array of albums or an album, system will get a random album to upload |
| 118 | +//$uploader->setAlbumId(array('51652569125195125', '515124156195725')); |
| 119 | +//$uploader->setAlbumId('51652569125195125'); |
| 120 | +if (!$uploader->hasValidToken()) { |
| 121 | + $uploader->getOAuthToken('http://yourdomain.com/test.php'); |
| 122 | +} |
| 123 | +echo $uploader->upload(getcwd(). '/test.jpg'); |
| 124 | +// this plugin does not support transload image |
| 125 | +``` |
122 | 126 |
|
123 | 127 | ### Upload to Flickr
|
124 | 128 | To upload image to Picasa, you need to have some AlbumIds otherwise the image will be uploaded to _default_ album.
|
125 | 129 | To create new AlbumId faster, you may use echo `$uploader->addAlbum('testing 1');`
|
126 |
| - |
127 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Flickr'); |
128 |
| - $uploader->setApi('API key'); |
129 |
| - $uploader->setSecret('API secret'); |
130 |
| - $token = $uploader->getOAuthToken('http://yourdomain.com/test.php'); |
131 |
| - $uploader->setAccessToken($token['oauth_token'], $token['oauth_token_secret']); |
132 |
| - |
133 |
| - echo $uploader->upload(getcwd(). '/test.jpg'); |
134 |
| - // this plugin does not support transload image |
| 130 | +```php |
| 131 | +$uploader = ChipVN_ImageUploader_Manager::make('Flickr'); |
| 132 | +$uploader->setApi('API key'); |
| 133 | +$uploader->setSecret('API secret'); |
| 134 | +$token = $uploader->getOAuthToken('http://yourdomain.com/test.php'); |
| 135 | +$uploader->setAccessToken($token['oauth_token'], $token['oauth_token_secret']); |
| 136 | +echo $uploader->upload(getcwd(). '/test.jpg'); |
| 137 | +// this plugin does not support transload image |
| 138 | +``` |
135 | 139 |
|
136 | 140 | ### Upload to Imageshack
|
137 |
| - |
138 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Imageshack'); |
139 |
| - $uploader->login('your account', 'your password'); |
140 |
| - $uploader->setApi('your api here'); |
141 |
| - echo $uploader->upload(getcwd(). '/a.jpg'); |
142 |
| - echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
| 141 | +```php |
| 142 | +$uploader = ChipVN_ImageUploader_Manager::make('Imageshack'); |
| 143 | +$uploader->login('your account', 'your password'); |
| 144 | +$uploader->setApi('your api here'); |
| 145 | +echo $uploader->upload(getcwd(). '/a.jpg'); |
| 146 | +echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
| 147 | +``` |
143 | 148 |
|
144 | 149 | ### Upload to Imgur
|
145 |
| - |
146 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Imgur'); |
147 |
| - $uploader->setApi('your client id'); |
148 |
| - $uploader->setSecret('your client secret'); |
149 |
| - // you may upload with anonymous account but may be the image will be deleted after a period of time |
150 |
| - // $uploader->login('your account here', 'your password here'); |
151 |
| - echo $uploader->upload(getcwd(). '/a.jpg'); |
152 |
| - echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
| 150 | +```php |
| 151 | +$uploader = ChipVN_ImageUploader_Manager::make('Imgur'); |
| 152 | +$uploader->setApi('your client id'); |
| 153 | +$uploader->setSecret('your client secret'); |
| 154 | +// you may upload with anonymous account but may be the image will be deleted after a period of time |
| 155 | +// $uploader->login('your account here', 'your password here'); |
| 156 | +echo $uploader->upload(getcwd(). '/a.jpg'); |
| 157 | +echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
| 158 | +``` |
153 | 159 |
|
154 | 160 | ### Upload to Postimage
|
155 |
| - |
156 |
| - $uploader = ChipVN_ImageUploader_Manager::make('Postimage'); |
157 |
| - // you may upload with anonymous account but may be the image will be deleted after a period of time |
158 |
| - // $uploader->login('your account here', 'your password here'); |
159 |
| - echo $uploader->upload(getcwd(). '/a.jpg'); |
160 |
| - echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
161 |
| - |
| 161 | +```php |
| 162 | +$uploader = ChipVN_ImageUploader_Manager::make('Postimage'); |
| 163 | +// you may upload with anonymous account but may be the image will be deleted after a period of time |
| 164 | +// $uploader->login('your account here', 'your password here'); |
| 165 | +echo $uploader->upload(getcwd(). '/a.jpg'); |
| 166 | +echo $uploader->transload('http://img33.imageshack.us/img33/6840/wz7u.jpg'); |
| 167 | +``` |
162 | 168 |
|
0 commit comments