Pods generates remote host URL, doesn't play well with timthumb

0

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.

asked Oct 15 '10 at 11:52

Halvard

3

edited Oct 15 '10 at 12:02

add comment
enter at least 15 characters

4 Answers

0

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)

answered Oct 15 '10 at 9:58

Fike

208

add comment
enter at least 15 characters
0

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

answered Oct 15 '10 at 3:50

benfavre

74

edited Oct 16 '10 at 12:21

add comment
enter at least 15 characters
0

Thank you both!

answered Oct 16 '10 at 2:09

Halvard

3

add comment
enter at least 15 characters
0

Nevermind. Solved.

answered Oct 16 '10 at 6:57

Halvard

3

edited Oct 16 '10 at 7:00

add comment
enter at least 15 characters