• Resolved strikedamic

    (@strikedamic)


    Hey all
    I have a problem with IE.
    I’m using Opera and a WordPress Plugin to make the insertion of images into a blog post easy and unified.
    I added some code to automatically get, resize and insert the image:

    <?php
    $size = getimagesize (c2c_get_custom('image'));
    $divide = $size[0] / 150;
    $high = $size[1] / $divide;
    echo $high ?>
    " hspace="3" vspace="3" width="150" />

    Works perfectly in Opera, but IE only displays a 1px wide line of different colors, supposedly the first 1px wide line of the image!

    What can I do? I don’t know how to identify browsers, and I can’t think of any other code that would work for IE.

    Can anyone please post some code (maybe an if…else) that’d solve this for me?

    Thank you very much!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    What’s the resulting HTML code look like? Can you point us to a link where we can see the problem in action?

    Thread Starter strikedamic

    (@strikedamic)

    Sure.
    You gotta try the same link in Opera and IE:
    http://sinister.ch/hot/wp/?p=28

    Thread Starter strikedamic

    (@strikedamic)

    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??

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter strikedamic

    (@strikedamic)

    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? 🙁

    Moderator Samuel Wood (Otto)

    (@otto42)

    WordPress.org Admin

    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.

    Thread Starter strikedamic

    (@strikedamic)

    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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘IE can’t resize images!’ is closed to new replies.