TimThumb works when path is relative, but not when absolute path

Please can you help?

Basically I bought the Centita theme from ThemeForest and Ive installed it on my server

Read More

The main problem im facing is that the TimThumb reads my thumbnails/ images with an absolute path:

http://ohmu.co.za/wp-content/themes/centita/timthumb.php?src=http://ohmu.co.za/wp-content/themes/centita/images/img-main1.jpg&h=90&w=66&zc=1

Which gives a 500 error.

After investigation, finally, I found that a relative path works:

http://ohmu.co.za/wp-content/themes/centita/timthumb.php?src=/wp-content/themes/centita/images/img-main1.jpg&h=90&w=66&zc=1

So my questions are as follows:

Do I edit the theme to refer to relative paths? how would I do that exactly?

OR how would I get the absolute paths to work?


I haven’t been working with WordPress for too long, but im generally good with troubleshooting until im blue in my face, this issue has been a bit much for me though. I would really appreciate the help.


Just to let you know what I have tried so that you dont suggest it:

Ive changed .htaccess to show ( which made my site not display, so I removed it)

SecFilterEngine Off
SecFilterScanPost Off

GD Library is supported and enabled

TimThumb is new and updated version

Chmods all changed to 777

Related posts

Leave a Reply

1 comment

  1. The problem should be caused by the host, because some hosts do not allow the use of http://www in the URL.

    If the image you want to show is in your site there is no need to use absolute path, so you can pass relative path without problems …

    To make an url relative, the simplest way is to replace the domain name in the string containing the URL from PHP code you can use the str_replace function :

    $url = str_replace(get_bloginfo('url'), '', $url);
    

    Note the function get_bloginfo in wordpress should get the base url of the site, otherwise you can even use an hardcoded version (in your case : http://ohmu.co.za )

    Take a look also at this useful article that explain well how to deal with paths in WordPress .

    Bear in mind that there is a more specialized forum on StackExchange where you can ask question about WordPress, that is : WordPress Answer.