Server B handling add_image_size() differently than Server A
-
16-10-2019 - |
Question
I'm curious what dependencies add_image_size()
has because I just copied a theme over to a new server and began adding thumbnails to custom post types only to find out that my request for hard-cropping is being ignored, and the images are kept proportional.
functions.php
...
set_post_thumbnail_size( 80, 80, true );
add_image_size( 'micro', 32, 32, true);
add_image_size( 'featured', 340, 225, true );
add_image_size( 'videowide', 460, 225, true );
...
On my local server (WAMP Server on Windows Vista) the true
is respected, and the images are cropped in such a way that extra pixels are lost - edges aren't respected. On my live server (CloudLinux Server 5.5 x64), the images are kept proportional.
Is there some gdlibrary dependencies or something I am needing to change on the live server to get the expected results?
Solution
This particular issue was caused by an environment missing GD. After installing GD on the server, the issue was resolved. Of course you will need to go back and re-submit your thumbnails to have correct cropping, or use a plugin to retroactively recreate your thumbnails.
OTHER TIPS
Your question reminded me of a time when I was playing with the Wordpress 3.0 beta and ran into a similar issue. Not sure if this will help you or not, but I stumbled across this post in the Wordpress forums.
Hi guys.
I´ve spent a lot of my day looking for a solution for this issue and here is the solution, in front of my eyes! Thanks to stylishbeachbum and Alex Mansfield. Yeah, the issue depends of the server. I´m using apache/php/mysql on Windows XP and the php_hd2 extension wasn´t enabled.
I´ve enabled that and now is working.
Thank you guys.
I'd love to know if this is the case. I had a few experiments in my Wordpress lab using custom image sizes, but abandoned my tinkering when I mas met with similar oddities.