Pods generates remote host URL, doesn't play well with timthumb
I'm trying to implement timthumb on my Pods pages, using this code:
<img src="<?php bloginfo(template_url); ?>/includes/timthumb.php?src=<?php echo $record_produktbilde; ?>&h=150&w=150&zc=1" alt="<?php echo $record_name; ?>">
Which generates this:
http://stage.soma.no/wp-content/themes/soma/includes/timthumb.php?src=http://91.135.51.230//wp-content/uploads/2010/04/Cocosa_extra_virgin_norsk09-2.png
And, unfortunately, this error:
remote host "91.135.51.230" not allowed
Swapping out the IP with the domain URL makes it work.
I only get this error using timthumb. Pods handles images and files perfectly otherwise.
Is there some way I can solve this by altering Pods code? Or do I need to do some scary URL rewriting? I'm stuck using an IIS server.
edited Oct 15 '10 at 12:02
4 Answers
The second parameter is not a searched string, but a set of chars to be stripped from the beggining or end, so, for example, "http://91.135.51.230/pht/1.jpg" will convert to "jpg". Better to use str_ replace (in case it is sure that this ip won't be changed later) or preg_ replace (in case there's no need to hardcode this ip)
http://www.php.net/manual/en/function.trim.php
$img = $record_produktbilde; $img_nodomain = trim($img, "http://91.135.51.230/);
Edit: this is crap don't know what i was thinking. go for str_replace
edited Oct 16 '10 at 12:21
Nevermind. Solved.
edited Oct 16 '10 at 7:00


