What’s the resulting HTML code look like? Can you point us to a link where we can see the problem in action?
Sure.
You gotta try the same link in Opera and IE:
http://sinister.ch/hot/wp/?p=28
I just checked the resulting code in IE:
<img src="
http://sinister.ch/hot/wp/wp-content/uploads/2007/12/1519_xxl.jpg" alt="
Hostel 2 Cover" align="left" border="3" height="
<br />
<b>Warning</b>: getimagesize() [<a href='function.getimagesize'>function.getimagesize</a>]: URL file-access is disabled in the server configuration in <b>/home/sinister/public_html/hot/wp/wp-content/themes/dark-city-10/single.php</b> on line <b>39</b><br />
<br />
<b>Warning</b>: getimagesize(http://sinister.ch/hot/wp/wp-content/uploads/2007/12/1519_xxl.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: no suitable wrapper could be found in <b>/home/sinister/public_html/hot/wp/wp-content/themes/dark-city-10/single.php</b> on line <b>39</b><br />
<br />
<b>Warning</b>: Division by zero in <b>/home/sinister/public_html/hot/wp/wp-content/themes/dark-city-10/single.php</b> on line <b>41</b><br />
" hspace="3" vspace="3" width="150" />
What do I have to change??
Ah. It’s giving you this error:
Warning: getimagesize() [URL file-access is disabled in the server configuration in /home/sinister/public_html/hot/wp/wp-content/themes/dark-city-10/single.php</b> on line 39
So, I assume the custom field of “image” that you’re using has the http URL to the image. Well, there’s your problem, you can’t call getimagesize on a URL on your server. And even if you could, it would be a bad idea to do so since there would be a lot of extra load on the system.
What you need is the actual location of the file on the server. The text of “/home/sinister/public_html/hot/wp/wp-content/uploads/2007/12/1519_xxl.jpg” for this specific case. One way would be a simple text replacement on the URL to fix up the string, like so:
<?php
$size = getimagesize (str_replace('http://sinister.ch', '/home/sinister/public_html', c2c_get_custom('image')));
$divide = $size[0] / 150;
$high = $size[1] / $divide;
echo $high ?>
" hspace="3" vspace="3" width="150" />
That should do the job for you.
OK the code you provided actually fixed the problem to a certain extent, thank you.
Now, in IE, images that are NOT on my server (found via google, for example) are being shown as “one-liners”. all Images that are on my server are being shown properly. Opera still displays all of them.
What now? 🙁
Well, those images cannot be fixed. See, you cannot getimagesize on a URL. So if it’s not on your server, you can’t do a getimagesize on it at all.
You really shouldn’t be hotlinking images from other servers anyway. It’s considered rude. Copy them to the server and change your links to point to those.
Okay, thank you for the information. I d/l’ed all the pics and put ’em on my server, intralinking them. It all works perfectly now. Thanks again!