Solving Problems with my GD Library JPEG Support
I recently encountered a problem with my blog that took me FOREVER to fix. I decided to write a post on it just because it was so hard to find anything on the web about the fix. Hopefully this will help out anyone else that ends up having the same problem.
Problem:
My blog could not generate thumbnail images when I uploaded jpeg files. After a LOT of poking around, I found that this was because jpeg support in my server's GD library was not enabled. After searching around for a couple hours, I wrote a quick php script to see what gd had enabled through php. I foundthat png and gif support were enabled for read/write, but jpeg was not listed at all. After more reading I found that this was likely due to conflicts between php and GD library which could be caused by a number of things.
Solution:
In my case, the problem was that the version of PHP that I was using was not compatible with GD2. Upon looking through some support documentation I found out that my website hosting service allows each website to choose which version of php they want to use. It appears that the default is php v4.0. It also seemed very clear that php 4.0 and GD2 were not friends. If your website is hosted by siteground.com and you are having problems with image processing that is related to GD library (especially specific to jpg/jpeg images) then here is the fix:
"SiteGround has recently introduced a unique server setup that allows each customer to choose which version of the PHP to use for his account. What is more the customer can even use different PHP versions for different directories in one and the same hosting account. The PHP versions currently supported are: PHP 5.0, PHP 5.1 and PHP 5.2.
In order to change the PHP version for your account, follow these steps. Go to cPanel, File Manager and choose "Web Root (public_html/www)". There create a new file called .htaccess containing the following line:
To switch to PHP 5.2:
AddHandler application/x-httpd-php52 .php .php5 .php4 .php3
To switch to PHP 5.0:
AddHandler application/x-httpd-php5 .php .php5 .php4 .php3
To switch to PHP 5.1:
AddHandler application/x-httpd-php51 .php .php5 .php4 .php3
This setting will apply recursively to all of the subdirectories. In case you'd like to have a different version of PHP in a subdirectory, create a new .htaccess file in it with the directive for the desired PHP version."
I changed php from version 4 to 5.2 and bingo, problem solved. Now you can see the thumbnail of that totally unrelated image at the top of the page.





1 comment
This post has 4 feedbacks awaiting moderation...
Leave a comment