Commit Graph

70 Commits

Author SHA1 Message Date
Mark Jaquith 53ea4e0566 Add functions for generating metadata for video and audio, using the
ID3 library. Also allows themes/plugins to add thumbnail support
to these media types. Think stuff like album art, movie covers, and
video freeze-frames.

props wonderboymusic. fixes #23673

git-svn-id: https://develop.svn.wordpress.org/trunk@23766 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-21 04:55:42 +00:00
Sergey Biryukov 458b77814c Declare the variable before using it. props danielbachhuber. fixes #23710.
git-svn-id: https://develop.svn.wordpress.org/trunk@23632 602fd350-edb4-49c9-b593-d223f7449a82
2013-03-07 04:46:19 +00:00
Sergey Biryukov 30650e32be Return WP_Error from wp_crop_image() if saving has failed. props macbrink. fixes #23325.
git-svn-id: https://develop.svn.wordpress.org/trunk@23374 602fd350-edb4-49c9-b593-d223f7449a82
2013-02-02 02:01:59 +00:00
Andrew Nacin f44d1d009e WP_Image_Editor: the last stand.
* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
 * Lazy-load the WP_Image_Editor base class and editor implementations.
 * Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
 * Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().

props DH-Shredder, scribu, markoheijnen. fixes #22356. see #6821.



git-svn-id: https://develop.svn.wordpress.org/trunk@22817 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-22 09:52:16 +00:00
Andrew Nacin 46a29a06e0 wp_generate_attachment_metadata() should not call WP_Image_Editor if there's nothing to resize. props mdawaffe. fixes #22438.
git-svn-id: https://develop.svn.wordpress.org/trunk@22571 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-14 14:26:52 +00:00
Ryan Boren 55543163fe In wp_crop_image(), preserve both src_file and src. src_file must be preserved even when url fopen is used so that we don't try to save to a filename based on the url.
see #6821


git-svn-id: https://develop.svn.wordpress.org/trunk@22553 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-13 00:03:55 +00:00
Ryan Boren 5f92c0e7f4 Pass an attachment ID, not a file path, to _load_image_to_edit_path() from wp_crop_image(). This fixes handling of attachments that require url fopen to access the image.
Allow passing urls instead of just file paths to WP_Image_Editor_Imagick::load() and WP_Image_Editor_GD::load() so that attachments requiring URL fopen can be handled.

see #6821


git-svn-id: https://develop.svn.wordpress.org/trunk@22538 602fd350-edb4-49c9-b593-d223f7449a82
2012-11-10 20:42:27 +00:00
Andrew Nacin cf3fe27ca0 Cast image metadata focal_length and shutter_speed to strings to restore previous behavior when stripslashes_deep() converted these values. Avoids rounding errors without making a determination of which digit we should round to. props jcakec. fixes #22259.
git-svn-id: https://develop.svn.wordpress.org/trunk@22319 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-28 16:17:56 +00:00
Ryan Boren 167cc00a84 Check for WP_Error return from WP_Image_Editor::get_instance().
Props markoheijnen
see #6821


git-svn-id: https://develop.svn.wordpress.org/trunk@22192 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-11 18:59:41 +00:00
Ryan Boren 7790af3154 Introduce WP_Image_Editor, WP_Image_Editor_Imagick, and WP_Image_Editor_GD. Abstracts image editing API and adds support for ImageMagick.
Props DH-Shredder, kurtpayne, markoheijnen
see #6821


git-svn-id: https://develop.svn.wordpress.org/trunk@22094 602fd350-edb4-49c9-b593-d223f7449a82
2012-10-01 20:59:06 +00:00
Andrew Nacin 818598ac2c Deprecate wp_create_thumbnail(). props obenland. fixes #21555.
git-svn-id: https://develop.svn.wordpress.org/trunk@21956 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-23 17:48:24 +00:00
Andrew Nacin 30cc580f76 Avoid mangling UTF-8 strings that may be present in image metadata. props SergeyBiryukov for the unit tests [UT665]. fixes #9417.
git-svn-id: https://develop.svn.wordpress.org/trunk@21905 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-18 23:38:25 +00:00
Andrew Nacin 1e270f44a4 Remove 'hwstring_small' from attachment metadata and deprecate get_udims(). props SergeyBiryukov. fixes #21518.
git-svn-id: https://develop.svn.wordpress.org/trunk@21808 602fd350-edb4-49c9-b593-d223f7449a82
2012-09-11 01:38:26 +00:00
Ryan Boren 1f3b3fada6 Make sure the path exists before copying. see #20657
git-svn-id: https://develop.svn.wordpress.org/trunk@21039 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-10 01:26:12 +00:00
Andrew Ozz 971e81c326 Fix notice in wp_read_image_metadata() when EXIF ISOSpeedRatings is array, props nacin, fixes #20807
git-svn-id: https://develop.svn.wordpress.org/trunk@20978 602fd350-edb4-49c9-b593-d223f7449a82
2012-06-02 01:39:00 +00:00
Ryan Boren b6e23d7269 Shears of vigorous pinking.
git-svn-id: https://develop.svn.wordpress.org/trunk@20944 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-27 16:25:43 +00:00
Ryan Boren c992db3d22 Remove debug cruft. Fix typo. Props SergeyBiryukov. fixes #20657
git-svn-id: https://develop.svn.wordpress.org/trunk@20808 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-16 18:11:19 +00:00
Ryan Boren b36e895a24 Create a new attachment and make a copy of the image when selecting an image from the image library. This prevents orphaning the header if the original attachment is deleted. This also prevents stomping of meta.
Add a button to skip cropping.

Props SergeyBiryukov
Fixes #20657 #20667


git-svn-id: https://develop.svn.wordpress.org/trunk@20806 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-16 17:47:55 +00:00
Ryan Boren cdc9ebd779 Make the file names unique for cropped header images. Props SergeyBiryukov. fixes #20666
git-svn-id: https://develop.svn.wordpress.org/trunk@20787 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-14 17:53:03 +00:00
Ryan Boren 71150d164a Don't convert png to jpg when cropping a header. Prevents stomping transparency. Props SergeyBiryukov, kovshenin. fixes #20555
git-svn-id: https://develop.svn.wordpress.org/trunk@20706 602fd350-edb4-49c9-b593-d223f7449a82
2012-05-02 21:35:56 +00:00
Ryan Boren 1b6cda0c48 Use correct var name. Props mattonomics. fixes #20432
git-svn-id: https://develop.svn.wordpress.org/trunk@20454 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-12 21:02:24 +00:00
Ryan Boren 6fde0bddaf Make choosing a header image from the media library play nicely with file replication plugins that do not guarantee images will be retained in the local filesystem.
* When passing an attachment ID to wp_crop_image(), use load_image_to_edit() to fetch the image via a url fopen when the image does not exist in the filesystem.
* Move load_image_to_edit() to wp-admin/includes/image.php so that it is always available for admin pages loads.
* Fallback to the height and width stored in the attachment meta when the image no longer exists in the filesystem.

see #19840


git-svn-id: https://develop.svn.wordpress.org/trunk@20384 602fd350-edb4-49c9-b593-d223f7449a82
2012-04-06 20:47:24 +00:00
Ryan Boren a8d77cbae9 User lowercase true, false, null instead of uppercase. Props c3mdigital, mfields. fixes #16302
git-svn-id: https://develop.svn.wordpress.org/trunk@19687 602fd350-edb4-49c9-b593-d223f7449a82
2012-01-05 20:50:54 +00:00
Ryan Boren 676ba7043e Use one space, not two, after trailing punctuation. fixes #19537
git-svn-id: https://develop.svn.wordpress.org/trunk@19593 602fd350-edb4-49c9-b593-d223f7449a82
2011-12-13 23:45:31 +00:00
Jon Cave 60d321b14b Fix typos in documentation (wp-admin/). See #18560.
git-svn-id: https://develop.svn.wordpress.org/trunk@18632 602fd350-edb4-49c9-b593-d223f7449a82
2011-09-03 14:18:10 +00:00
Dion Hulse c552d48674 Fix image_resize() dependencies by moving wp_load_image() from admin includes to wp-includes. Fixes #7279
git-svn-id: https://develop.svn.wordpress.org/trunk@13860 602fd350-edb4-49c9-b593-d223f7449a82
2010-03-28 03:39:00 +00:00
Andrew Nacin d4854cef04 Use utf8_encode() consistently in wp_read_image_metadata(). Also add some whitespace. props miqrogroove, see #11417, see #12095
git-svn-id: https://develop.svn.wordpress.org/trunk@13249 602fd350-edb4-49c9-b593-d223f7449a82
2010-02-20 12:09:30 +00:00
Andrew Nacin d824d6bbd4 Improved IPTC and EXIF handling. Drag a wider net and also try to avoid numeric attachment slugs where possible. Props miqrogroove. See #11417
git-svn-id: https://develop.svn.wordpress.org/trunk@13244 602fd350-edb4-49c9-b593-d223f7449a82
2010-02-20 09:17:34 +00:00
Ryan Boren c01fb90ff1 Deprecate wp_shrink_dimension(), add wp-admin/includes/deprecated.php. Props filosofo. fixes #11967
git-svn-id: https://develop.svn.wordpress.org/trunk@12823 602fd350-edb4-49c9-b593-d223f7449a82
2010-01-25 18:50:01 +00:00
Peter Westwood 2e2ad12171 Add missing version numbers to _deprecated_argument() calls.
Remove deprecated argument from xfn_check() calls.
Pass version number to deprecated_file_included, deprecated_function_run and deprecated_argument_run actions.
Fixes #11386 props nacin.

git-svn-id: https://develop.svn.wordpress.org/trunk@12680 602fd350-edb4-49c9-b593-d223f7449a82
2010-01-09 10:03:55 +00:00
Peter Westwood b5a43efa73 Introduce a single function for getting all the intermediate image sizes to be used both when adding attachements and deleting. Fixes #10263 props scribu.
git-svn-id: https://develop.svn.wordpress.org/trunk@12659 602fd350-edb4-49c9-b593-d223f7449a82
2010-01-08 08:51:12 +00:00
Peter Westwood a752e6b561 Updates and improvements to _depreceated_argument. See #11386 props nacin.
git-svn-id: https://develop.svn.wordpress.org/trunk@12584 602fd350-edb4-49c9-b593-d223f7449a82
2009-12-30 16:23:39 +00:00
Ryan Boren 7ccd64fbe7 Retunr WP_Error from wp_crop_image() and image_resize(). Props mdwaffe. fixes #9922
git-svn-id: https://develop.svn.wordpress.org/trunk@12524 602fd350-edb4-49c9-b593-d223f7449a82
2009-12-23 18:39:31 +00:00
Mark Jaquith ab97039f96 Post/Page Image was too generic a name. Post/Page Thumbnail is more clear, even if you can create very large thumbnail images if you so choose.
git-svn-id: https://develop.svn.wordpress.org/trunk@12351 602fd350-edb4-49c9-b593-d223f7449a82
2009-12-10 06:14:36 +00:00
Peter Westwood 8d300bf5b7 s/size/s/ fixes #11370 props nacin.
git-svn-id: https://develop.svn.wordpress.org/trunk@12346 602fd350-edb4-49c9-b593-d223f7449a82
2009-12-09 09:44:53 +00:00
Mark Jaquith 54410e03f6 Introducing set_post_image_size(w, h, crop) so themes can register their special size/crop for canonical post images. WP will create this size/crop upon upload, so your canonical post images fit your space exactly!
git-svn-id: https://develop.svn.wordpress.org/trunk@12342 602fd350-edb4-49c9-b593-d223f7449a82
2009-12-08 21:08:19 +00:00
Andrew Ozz 52bff7f918 Fix image meta after editing image, disable the Save button when no changes, fixes #11115
git-svn-id: https://develop.svn.wordpress.org/trunk@12163 602fd350-edb4-49c9-b593-d223f7449a82
2009-11-11 11:24:01 +00:00
Andrew Ozz 4f22e99cf5 Image editing (first run). Includes code by stephanreiter, see #10528
git-svn-id: https://develop.svn.wordpress.org/trunk@11911 602fd350-edb4-49c9-b593-d223f7449a82
2009-09-10 22:07:33 +00:00
Andrew Ozz b310ef4a08 Add attachment ID to the wp_generate_attachment_metadata filter, props taco1991, fixes #10494
git-svn-id: https://develop.svn.wordpress.org/trunk@11747 602fd350-edb4-49c9-b593-d223f7449a82
2009-07-27 23:08:21 +00:00
Andrew Ozz 3bf18aa189 Banishing ASCII quotes and apostrophes, props demetris, fixes #9655
git-svn-id: https://develop.svn.wordpress.org/trunk@11190 602fd350-edb4-49c9-b593-d223f7449a82
2009-05-05 04:28:05 +00:00
Peter Westwood 0560f26f76 Allow a plugin to change the jpeg image quality. Fixes #9245 props filosofo.
git-svn-id: https://develop.svn.wordpress.org/trunk@10682 602fd350-edb4-49c9-b593-d223f7449a82
2009-03-02 21:55:40 +00:00
Ryan Boren baaaa352ba Strip trailing whitespace
git-svn-id: https://develop.svn.wordpress.org/trunk@10150 602fd350-edb4-49c9-b593-d223f7449a82
2008-12-09 18:03:31 +00:00
Andrew Ozz abdc564e7a Fix thumbnails creation for 8bpp and CMYK images, props DD32, fixes #7039 fixes #8231
git-svn-id: https://develop.svn.wordpress.org/trunk@9727 602fd350-edb4-49c9-b593-d223f7449a82
2008-11-15 23:16:36 +00:00
Ryan Boren 6d727a9c2b phpdoc for wp-admin. Props jacobsantos. see #7527
git-svn-id: https://develop.svn.wordpress.org/trunk@9119 602fd350-edb4-49c9-b593-d223f7449a82
2008-10-10 18:21:16 +00:00
Ryan Boren f885a9f93a phpdoc for wp-admin/includes from jacobsantos. see #7527
git-svn-id: https://develop.svn.wordpress.org/trunk@9053 602fd350-edb4-49c9-b593-d223f7449a82
2008-10-02 01:03:26 +00:00
Ryan Boren 3e43adeb6e phpdoc for wp-admin/includes from jacobsantos. see #7527
git-svn-id: https://develop.svn.wordpress.org/trunk@8912 602fd350-edb4-49c9-b593-d223f7449a82
2008-09-17 00:40:10 +00:00
Ryan Boren 9e7d65df0d Thumbnail and exif fixes from DD32. see #7622
git-svn-id: https://develop.svn.wordpress.org/trunk@8879 602fd350-edb4-49c9-b593-d223f7449a82
2008-09-13 18:04:20 +00:00
Ryan Boren 9045798e95 Make attachment file path relative to the upload dir. Don't use GUID to find attachement URL. Props DD32. see #7622
git-svn-id: https://develop.svn.wordpress.org/trunk@8796 602fd350-edb4-49c9-b593-d223f7449a82
2008-09-02 22:55:39 +00:00
Peter Westwood 903915c067 utf8 encode data from IPTC tags. Fixes #7495 for trunk props Txanny.
git-svn-id: https://develop.svn.wordpress.org/trunk@8744 602fd350-edb4-49c9-b593-d223f7449a82
2008-08-27 06:54:48 +00:00
Ryan Boren da4e0eca48 Separate Large and Full image sizes. Props tellyworth. fixes #7151
git-svn-id: https://develop.svn.wordpress.org/trunk@8612 602fd350-edb4-49c9-b593-d223f7449a82
2008-08-11 03:54:26 +00:00