Make WordPress Core

Opened 13 years ago

Last modified 8 years ago

#6821 closed task (blessed)

ImageMagick support — at Version 19

Reported by: matt Owned by: tellyworth
Milestone: 3.5 Priority: normal
Severity: normal Version: 2.5
Component: Upload Keywords: has-patch needs-testing needs-codex
Focuses: Cc:

Description (last modified by scribu)

Our image handling and resizing functions should magically detect whether IM is available and usable (much like Gallery does) and use them where appropriate, as it's a lot more efficient than PHP's built-in GD functions.

Change History (20)

#1 @jacobsantos
13 years ago

I think it would be cool to include an image library that allow for plugins to extend the library to implement these extra features.

#2 @Denis-de-Bernardy
12 years ago

  • Component changed from General to Upload

#3 @ryan
11 years ago

  • Milestone changed from 2.9 to Future Release

#4 @scribu
10 years ago

Marked #11671 as duplicate.

#6 @azaozz
10 years ago

This is probably the oldest to-do on my list too. Postponed it 2 years ago as ImageMagick was relatively rare. Perhaps it's time to look into this again, would also need to reevaluate which serves us better IM or GD (that are available in PHP 5.2.4+).

#7 @scribu
10 years ago

Marked #18539 as duplicate.

#8 @GaryJ
9 years ago

A note for a utopia future where PHP 5.3 is a minimum version for WP - related: https://github.com/avalanche123/Imagine

#9 @nacin
9 years ago

  • Keywords blessed removed
  • Milestone changed from Future Release to 3.5
  • Type changed from enhancement to task (blessed)

I would really like to see Imagemagick support added to 3.5, to complement our focus on the media, upload, and gallery user experience.

This ticket needs someone (or a few someones) to grab it by the horns and run with it. If your strong suit is API and backend development but want to contribute to the media/upload project in 3.5, this is definitely a great way to help.

#10 @markoheijnen
9 years ago

  • Cc markoheijnen added

I'm curious in how we should implement this. The implementation would be something like how it is done with the HTTP API.
I'm also curious if this will effect server load like in case of WordPress.com.

#11 @nacin
9 years ago

See also #18543 - wrapping our GD functions in methods that can allow for using stream wrappers (CDN integration, etc.).

Yes, I do picture an API that looks a lot like the HTTP API. (This could be done as an interface, though an abstract base class would probably make sense, in case there is any shared functionality.) We would support both GD and IM in core, with a preference toward IM, and replace all of our direct GD function calls with this new API.

#12 @Japh
9 years ago

  • Cc japh@… added

#13 @tomauger
9 years ago

  • Cc tomaugerdotcom@… added

#14 @mikeschroder
9 years ago

  • Cc mike.schroder@… added

Chatted with nacin, Japh, TomAuger, and MarkoHeijnen on this in dev chat today, and doing some research into our use of GD for the best way to build an API to accomplish this.

This will likely turn out to be something very similar to the HTTP API, as nacin has suggested.

#15 @mikeschinkel
9 years ago

  • Cc mikeschinkel@… added

#16 @tomauger
9 years ago

So, what's the best way to inventory all the current usages of GD library functions in core? Just iterating through all the functions available on http://www.php.net/manual/en/ref.image.php seems like a pretty brute force way to go.

#17 @Japh
9 years ago

There are 103 functions listed under "GD and Image Functions" on PHP.net, and we have used 23 of them across 7 files:

  • ./wp-admin/custom-header.php
  • ./wp-admin/includes/image.php
  • ./wp-includes/deprecated.php
  • ./wp-includes/functions.php
  • ./wp-includes/media.php
  • ./wp-admin/includes/image.php
  • ./wp-admin/includes/image-edit.php

Specific functions used are:

  • getimagesize
  • imagealphablending
  • imagesavealpha
  • imageantialias
  • imagetruecolortopalette
  • imagecolorstotal
  • imagecopyresampled
  • imagecopy
  • imagecreatefromjpeg
  • imagecreatefrompng
  • imagecreatefromgif
  • imagecreatefromstring
  • imagecreatetruecolor
  • imagedestroy
  • imagegif
  • imageistruecolor
  • imagejpeg
  • imagepng
  • imagerotate
  • imagesx
  • imagesy
  • imagetypes
  • iptcparse

It might be worth checking through ImageMagick functions to see if there can be any direct mapping.

#18 @tomauger
9 years ago

Woot! Awesome work. I'll get started on the NetPM and IM mappings to try to see whether we can design a versatile interface. Then it will just be a matter of creating some adaptors and then replacing all the function calls with method calls.

9 years ago

INCOMPLETE - just a starting point for discussion around general high-level methods for library-independent image manipulation.

#19 @scribu
9 years ago

  • Description modified (diff)
  • Summary changed from Netpbm and Imagemagick support to ImageMagick support
Note: See TracTickets for help on using tickets.