WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 3 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)

comment:1 @jacobsantos7 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.

comment:2 @Denis-de-Bernardy6 years ago

  • Component changed from General to Upload

comment:3 @ryan6 years ago

  • Milestone changed from 2.9 to Future Release

comment:4 @scribu4 years ago

Marked #11671 as duplicate.

comment:6 @azaozz4 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+).

comment:7 @scribu4 years ago

Marked #18539 as duplicate.

comment:8 @GaryJ4 years ago

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

comment:9 @nacin3 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.

comment:10 @markoheijnen3 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.

comment:11 @nacin3 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.

comment:12 @Japh3 years ago

  • Cc japh@… added

comment:13 @tomauger3 years ago

  • Cc tomaugerdotcom@… added

comment:14 @DH-Shredder3 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.

comment:15 @mikeschinkel3 years ago

  • Cc mikeschinkel@… added

comment:16 @tomauger3 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.

comment:17 @Japh3 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.

comment:18 @tomauger3 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.

@tomauger3 years ago

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

comment:19 @scribu3 years ago

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