-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from uploadcare/revamp-media-lib
Revamp media lib
- Loading branch information
Showing
10 changed files
with
345 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,37 @@ | ||
# Wordpress plugin for Uploadcare | ||
|
||
This is a plugin for [Wordpress][5] to work with [Uploadcare][1] | ||
|
||
It's based on a [uploadcare-php][4] library. | ||
|
||
## Requirements | ||
|
||
- Wordpress 3.5+ | ||
- PHP 5.2+ | ||
- php-curl | ||
|
||
## Install | ||
|
||
1. [Download the latest release][3]. The zip file contains the Wordpress plugin itself and all its dependencies. | ||
2. Unzip file to your wp-content/plugins folder. | ||
3. Activate plugin at "Plugins" page inside your Wordpress admin. | ||
4. Go to "Settings" -> "Uploadcare settings" and enter the public and secret keys for your account. | ||
To receive your keys, create your FREE account at [Uploadcare](https://uploadcare.com/accounts/create/plan-based/2/) | ||
5. Create new post and feel yourself proud! | ||
|
||
Send us your feedback, [email protected] | ||
|
||
## Usage | ||
|
||
1. Begin adding a new post. | ||
2. Press "Add Media" to insert media with the Uploadcare widget. | ||
3. Upload a file using the widget. | ||
4. Crop the file if you wish. Only the cropped area will be inserted. | ||
5. Press "Store and Insert". The image will be inserted into your post. | ||
|
||
## Releases | ||
|
||
**2.0.8** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.8.zip)) | ||
* Fix pagination in media tab | ||
|
||
**2.0.7** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.7.zip)) | ||
* Support featured images via Uploadcare | ||
* New setting "Use Uploadcare for featured images". | ||
* Bugfixes | ||
|
||
**2.0.6** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.6.zip)) | ||
* New setting "Allow multiupload". | ||
* New setting "Uploadcare widget fine tuning". | ||
* Uploadcare widget updated to version 0.12 | ||
* Bugfixes | ||
|
||
**2.0.5** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.5.zip)) | ||
* New setting "Insert image with url to the original image". | ||
|
||
**2.0** | ||
* New plugin with new widget (0.7) and manual crop. | ||
|
||
**1.0.6** | ||
* Widget update. | ||
* Manual crop. | ||
|
||
**1.0.5** | ||
* Bugfix | ||
|
||
**1.0.4** | ||
* Bugfix | ||
|
||
**1.0.3** | ||
* More operations form validation | ||
* Fixed files deletion. | ||
* "Files" are shown as an Uploadcare logo. | ||
* Header is not displayed for Wordpress 3.5, updated for new "Add Media" | ||
|
||
**1.0.2** | ||
* Operation values no longer nulled when operations type is changed. | ||
* Insert files, not only images. | ||
* Opration values no longer nulled when operations type is changed. | ||
|
||
**1.0.1** | ||
* Scale crop and Resize are radio buttons now, not checkboxes. | ||
* Fixed script, showing "Store" button. | ||
|
||
**1.0.0** | ||
* Uploadcare widget updated to 0.5.0. Added facebook and instagr.am. | ||
* "Store" button is hidden until file is selected. | ||
* Uploaded files are saved in database. | ||
* Uploadcare file list uses only saved files, not all the files from Uploadcare account. | ||
* "Crop" operations is deleted. | ||
* "Resize" and "Scale Crop" cannot be used at the same time. | ||
* Minor fixes. | ||
|
||
**0.2.0** | ||
* New tab: Uploadcare Files - select previously uploaded files. | ||
* "Uploadcare" admin menu: view and delet previously uploaded files. | ||
|
||
**0.1.1** | ||
* readme.txt added | ||
|
||
**0.1.0** | ||
* Initial release. Implements Uploadcare tab. | ||
|
||
[1]: https://uploadcare.com/ | ||
[2]: https://uploadcare.com/documentation/reference/basic/cdn.html | ||
[3]: https://github.com/uploadcare/uploadcare-wordpress/releases | ||
[4]: https://github.com/uploadcare/uploadcare-php | ||
[5]: http://wordpress.org/ | ||
# Wordpress plugin for Uploadcare | ||
|
||
This is a plugin for [Wordpress][5] to work with [Uploadcare][1] | ||
|
||
It's based on a [uploadcare-php][4] library. | ||
|
||
## Requirements | ||
|
||
- Wordpress 3.5+ | ||
- PHP 5.2+ | ||
- php-curl | ||
|
||
## Install | ||
|
||
1. [Download the latest release][3]. The zip file contains the Wordpress plugin itself and all its dependencies. | ||
2. Unzip file to your wp-content/plugins folder. | ||
3. Activate plugin at "Plugins" page inside your Wordpress admin. | ||
4. Go to "Settings" -> "Uploadcare settings" and enter the public and secret keys for your account. | ||
To receive your keys, create your FREE account at [Uploadcare](https://uploadcare.com/accounts/create/plan-based/2/) | ||
5. Create new post and feel yourself proud! | ||
|
||
Send us your feedback, [email protected] | ||
|
||
## Usage | ||
|
||
1. Begin adding a new post. | ||
2. Press "Add Media" to insert media with the Uploadcare widget. | ||
3. Upload a file using the widget. | ||
4. Crop the file if you wish. Only the cropped area will be inserted. | ||
5. Press "Store and Insert". The image will be inserted into your post. | ||
|
||
|
||
[1]: https://uploadcare.com/ | ||
[2]: https://uploadcare.com/documentation/reference/basic/cdn.html | ||
[3]: https://github.com/uploadcare/uploadcare-wordpress/releases | ||
[4]: https://github.com/uploadcare/uploadcare-php | ||
[5]: http://wordpress.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
// add_action('post-upload-ui', 'uploadcare_media_upload'); | ||
function uploadcare_media_upload() { | ||
|
||
// if ( $post = get_post() ) | ||
// $browser_uploader .= '&post_id=' . intval( $post->ID ); | ||
// elseif ( ! empty( $GLOBALS['post_ID'] ) ) | ||
// $browser_uploader .= '&post_id=' . intval( $GLOBALS['post_ID'] ); | ||
|
||
$img = plugins_url('logo.png', __FILE__); | ||
|
||
?> | ||
|
||
<p class="uploadcare-picker"> | ||
<a class="button" style="padding-left: .4em;" href="javascript: uploadcareMediaButton();"> | ||
<span class="wp-media-buttons-icon" style="padding-right: 2px; vertical-align: text-bottom; background: url('<?php $img ?>') no-repeat 0px 0px;"> | ||
</span>Upload via Uploadcare | ||
</a> | ||
</p> | ||
<?php | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
## Changelog | ||
|
||
**2.0.9** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.9.zip)) | ||
* Uploadcare media library tab now shows all files from your Uploadcare account (project) | ||
* Allow cropping when inserting images via Uploadcare media library tab | ||
* Make Wordpress attachment when uploading file via "Add Media" button | ||
This should impove Uploadcare integration with Wordpress and 3rd party plugins | ||
|
||
**2.0.8** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.8.zip)) | ||
* Fix pagination in media tab | ||
|
||
**2.0.7** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.7.zip)) | ||
* Support featured images via Uploadcare | ||
* New setting "Use Uploadcare for featured images". | ||
* Bugfixes | ||
|
||
**2.0.6** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.6.zip)) | ||
* New setting "Allow multiupload". | ||
* New setting "Uploadcare widget fine tuning". | ||
* Uploadcare widget updated to version 0.12 | ||
* Bugfixes | ||
|
||
**2.0.5** ([Download](http://downloads.wordpress.org/plugin/uploadcare.2.0.5.zip)) | ||
* New setting "Insert image with url to the original image". | ||
|
||
**2.0** | ||
* New plugin with new widget (0.7) and manual crop. | ||
|
||
**1.0.6** | ||
* Widget update. | ||
* Manual crop. | ||
|
||
**1.0.5** | ||
* Bugfix | ||
|
||
**1.0.4** | ||
* Bugfix | ||
|
||
**1.0.3** | ||
* More operations form validation | ||
* Fixed files deletion. | ||
* "Files" are shown as an Uploadcare logo. | ||
* Header is not displayed for Wordpress 3.5, updated for new "Add Media" | ||
|
||
**1.0.2** | ||
* Operation values no longer nulled when operations type is changed. | ||
* Insert files, not only images. | ||
* Opration values no longer nulled when operations type is changed. | ||
|
||
**1.0.1** | ||
* Scale crop and Resize are radio buttons now, not checkboxes. | ||
* Fixed script, showing "Store" button. | ||
|
||
**1.0.0** | ||
* Uploadcare widget updated to 0.5.0. Added facebook and instagr.am. | ||
* "Store" button is hidden until file is selected. | ||
* Uploaded files are saved in database. | ||
* Uploadcare file list uses only saved files, not all the files from Uploadcare account. | ||
* "Crop" operations is deleted. | ||
* "Resize" and "Scale Crop" cannot be used at the same time. | ||
* Minor fixes. | ||
|
||
**0.2.0** | ||
* New tab: Uploadcare Files - select previously uploaded files. | ||
* "Uploadcare" admin menu: view and delet previously uploaded files. | ||
|
||
**0.1.1** | ||
* readme.txt added | ||
|
||
**0.1.0** | ||
* Initial release. Implements Uploadcare tab. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
add_filter('wp_get_attachment_url', 'uploadcare_get_attachment_url', 8, 2); | ||
function uploadcare_get_attachment_url($url, $post_id) { | ||
|
||
if(! $uc_url = get_post_meta($post_id, 'uploadcare_url', true)) { | ||
return $url; | ||
} | ||
return $uc_url; | ||
} | ||
|
||
add_filter('image_downsize', 'uploadcare_image_downsize', 9, 3); | ||
function uploadcare_image_downsize($value = false, $id, $size = 'medium') { | ||
if(! $uc_url = get_post_meta($id, 'uploadcare_url', true)) { | ||
return false; | ||
} | ||
|
||
$sz = uc_thumbnail_size($size); | ||
if($sz) { | ||
// chop filename part | ||
$url = preg_replace('/[^\/]*$/', '', $uc_url); | ||
$url .= '-/stretch/off/-/scale_crop/' . $sz . '/'; | ||
} else { | ||
$url = $uc_url; | ||
} | ||
return Array( | ||
$url, | ||
0, // size | ||
0, // width | ||
0, // height | ||
false, | ||
); | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
=== Uploadcare: Add media from anywhere === | ||
|
||
Contributors: grayhound1, dmitry-mukhin | ||
Tags: media upload, file handling, cdn, storage, facebook, dropbox, instagram, google drive | ||
Tags: media upload, file handling, cdn, storage, facebook, dropbox, instagram, google drive, vk, evernote, box, images | ||
Requires at least: 3.5+ | ||
Tested up to: 3.6.1 | ||
Stable tag: 2.0.8 | ||
Tested up to: 3.8.1 | ||
Stable tag: 2.0.9 | ||
License: GPLv2 or later | ||
License URI: http://www.gnu.org/licenses/gpl-2.0.html | ||
|
||
Uploadcare provides media uploading, processing and CDN for your blog. You can upload even very large images and crop them. | ||
|
||
|
||
== Description == | ||
|
||
### Features ### | ||
|
||
* Upload images of any resolution | ||
* Crop images | ||
* Upload documents and archives | ||
* Choose images from Facebook, Instagram or VK | ||
* Choose files from Dropbox or Google Drive | ||
* Choose files from Dropbox, Google Drive, Box, Evernote | ||
* Deliver your media through CDN, it's up to 5x times faster | ||
|
||
### Languages ### | ||
|
||
* English | ||
* Latvian | ||
* Polish | ||
|
@@ -29,6 +33,7 @@ Uploadcare provides media uploading, processing and CDN for your blog. You can u | |
* Chinese (simplified) | ||
|
||
### More information ### | ||
|
||
Check [Uploadcare.com](https://uploadcare.com/) to learn more. | ||
Send us your feedback, <[email protected]> | ||
|
||
|
@@ -57,6 +62,7 @@ To receive your keys, create your FREE account at [Uploadcare](https://uploadcar | |
* Wordpress 3.5+ | ||
* PHP 5.2+ | ||
* php-curl | ||
* php-json | ||
|
||
== Screenshots == | ||
|
||
|
@@ -79,6 +85,13 @@ To receive your keys, create your FREE account at [Uploadcare](https://uploadcar | |
2. "Fetured Image" meta box will be replaced with "Fetured Image (uploadcare)" if post type supports featured images | ||
|
||
== Changelog == | ||
|
||
= 2.0.9 = | ||
* Uploadcare media library tab now shows all files from your Uploadcare account (project) | ||
* Allow cropping when inserting images via Uploadcare media library tab | ||
* Make Wordpress attachment when uploading file via "Add Media" button | ||
This should impove Uploadcare integration with Wordpress and 3rd party plugins | ||
|
||
= 2.0.8 = | ||
* Fix pagination in media tab | ||
|
||
|
@@ -99,7 +112,7 @@ To receive your keys, create your FREE account at [Uploadcare](https://uploadcar | |
= 2.0.4 = | ||
* Uploadcare widget updated to version 0.8.1.2 | ||
|
||
= 2.0.3 = | ||
= 2.0.3 = | ||
* Bugfixes | ||
|
||
= 2.0.2 = | ||
|
@@ -111,19 +124,19 @@ To receive your keys, create your FREE account at [Uploadcare](https://uploadcar | |
= 2.0 = | ||
* New widget version, plugin refactored and ready to go. | ||
|
||
= 1.0.5 = | ||
= 1.0.5 = | ||
* Minor fixes | ||
|
||
= 1.0.4 = | ||
* Minor fixes | ||
|
||
= 1.0.3 = | ||
= 1.0.3 = | ||
* More operations form validation | ||
* Fixed files deletion. | ||
* "Files" are presented as Uploadcare logo. | ||
* Header is not displayed for Wordpress 3.5, updated for new "Add Media" | ||
|
||
= 1.0.2 = | ||
= 1.0.2 = | ||
* Operation values no longer nulled when operation type is changed. | ||
* Now inserts files, not only images. | ||
|
||
|
@@ -145,10 +158,10 @@ To receive your keys, create your FREE account at [Uploadcare](https://uploadcar | |
* New tab: Uploadcare Files - Select previously uploaded files. | ||
* "Uploadcare" admin menu: view and delet previously uploaded files. | ||
|
||
= 0.1.1 = | ||
= 0.1.1 = | ||
* Wordpress readme added. | ||
* Preview is now at the bottom of the form. | ||
* Scale and Crop "center" option is defaulted to "checked". | ||
|
||
= 0.1.0 = | ||
= 0.1.0 = | ||
* Initial release |
Submodule uploadcare-php
updated
16 files
+43 −3 | README.md | |
+21 −0 | changelog.md | |
+2 −2 | sample-project/examples.php | |
+2 −2 | sample-project/examples52.php | |
+38 −23 | tests/5.2/ApiTest.php | |
+37 −22 | tests/5.3/ApiTest.php | |
+100 −74 | uploadcare/lib/5.2/Api.php | |
+35 −12 | uploadcare/lib/5.2/File.php | |
+107 −0 | uploadcare/lib/5.2/Group.php | |
+2 −21 | uploadcare/lib/5.2/Uploadcare.php | |
+1 −1 | uploadcare/lib/5.2/Widget.php | |
+100 −74 | uploadcare/lib/5.3-5.4/Api.php | |
+34 −11 | uploadcare/lib/5.3-5.4/File.php | |
+109 −0 | uploadcare/lib/5.3-5.4/Group.php | |
+2 −15 | uploadcare/lib/5.3-5.4/Uploadcare.php | |
+1 −1 | uploadcare/lib/5.3-5.4/Widget.php |
Oops, something went wrong.