How to Simplify Image Manipulation in WordPress
By Marko Heijnen
Image manipulation, often a challenge for Web designers and developers, went through a significant revamp in the WordPress 3.5 launch.
This brought developers more flexibility within the platform and a more effective approach for generating image sizes within the popular content management system (CMS).
Previously, WordPress versions possessed much of the same code spread within their code base. This was resolved by abstracting the GD code (a graphics drawing library) from the core. For WordPress version 3.5 or newer, the images have transitioned to using new classes. The main class for shared methods became WP_Image_Editor, while the previous code is located in WP_Image_Editor_GD.
By separating GD, it is possible to integrate Imagick, a software suite to create, edit, compose or convert bitmap images. This is especially beneficial when working with images that possess extended color profiles. Due to its improved image quality, support for Imagick is included for all users whose Web host makes it available. If functions are used that are not Imagick supported, WordPress will automatically revert to GD. Now, developers can extend existing image manipulation engines or integrate their own.
In order for Web developers to take advantage of the increased power for image manipulation, they will need to review the function add_image_size(). This allows for the ability to establish the image’s name, width, height and areas to be cropped. However, users will notice some limitations once they attempt to accomplish more advanced manipulation.
Consider combining all code within one WordPress plugin. For example, Improved Image Editor currently focuses on the application programming interface (API), which is specifically beneficial for developers to add additional image-editing functionality. Such capabilities include image quality, zoom and filter.
5 Photo-Editing Plugins for WordPress
Discover more ways to create compelling, custom images at wsm.co/6picedit
The Improved Image Editor plugin currently offers a great set of features, and new elements are continuously being added. Coming soon, a new range of filters will be made available for developers to leverage for even more advanced image manipulation within WordPress.
Even though this plugin is still evolving, it is easy to see its incredible benefits for image manipulation and ease of installation...and it keeps getting better. Coming soon, WP_Image will be added to its functionality to streamline image editing within WordPress. Once completed, this will make it easier for users as it only requires a few lines of code to complete the process, as well as gives the ability to view and manage the image directly within the administration page.
Another plugin option to consider for image manipulation is WP Thumb. Users can integrate the plugin with WordPress image functions to specify height, width and crop values. Once completed, the image will then be created and cached for later use. This is particularly beneficial for those that wish to conduct on-demand photo resizing directly within the platform.
Many Web professionals rely on WP Thumb when working with clients that already have an extensive amount of images on their website. It eliminates the need to remove images from the backend just to re-upload them in a new form. Not only does it save significant disk space on large projects, but also time when accomplishing what can potentially be a tedious task.
By taking the time to understand the true value of image manipulation within WordPress, as well as the tools available to achieve it, Web professionals will be able to customize much more effectively.
Marko Heijnen is a WordPress Specialist at 1&1 and a contributor to the WordPress community. He has had a hand in developing seven releases since 3.0. Follow him on Twitter @markoheijnen.