• I duplicated and changed the the_category() function so that it now attaches an images with the categoryname to each post. This means that when a category has no image attached to it, the <img src=”…..”> will be displayed in the markup anyhow. In Mozilla this works ok, but in IE the <img src=”…..”> leads to this X mark to show that an image is not loaded properly.
    Is there a way to stop IE from doing that?
    I was happy to find a solution for myself for those categoryimages, but I forgot to check in IE, until this morning. Damn!

Viewing 9 replies - 1 through 9 (of 9 total)
  • I don’t think there is a way to stop IE from doing that as it is user dependent (I can stop it by de-selecting “Show image download placeholders”, you can’t). If you don’t want to write the code to check for an image, why don’t you just make a small transparent gif to use for each category for which you do not want/have an image?

    Thread Starter Jack

    (@moxie)

    Good suggestion:) So I tried it with the if(file_exists), but somehow I’m making a mistake in the code, because now no image at all is displayed. If it’s not too much asked, here’s the textfile of that php-file.

    It is late and if you haven’t gotten it by tomorrow, I will take a look at it when I get home, but I would first suggest testing the string you are trying to generate – maybe it is incorrect (and thus actually doesn’t exist).
    $file = blah-blah;
    if (file_exists($file)) { echo “the file $file exists” } else { echo “The file $filename does not exist”}

    Thread Starter Jack

    (@moxie)

    OK and thanks. But it’s not that late!? It’s just 08.27 in the morning where I live ?? I will try it later this day or perhaps tomorrow. Not enough time today I’m afraid…

    Thread Starter Jack

    (@moxie)

    I can’t get this to work properly. I inserted this code:
    $file = get_settings(‘home’).’/plaatjes/’.$category->cat_name.’.gif’;
    if (file_exists($file)) {
    in the php-file (https://www.spoenk.nl/public/catimage.txt) and now no images show up at all. When I leave out the if(file_exists… part I do get to see the proper image in Mozilla and at the same the time the echo-message that that file doesn’t exist!?
    So I get the message ‘https://www.spoenk.nl/weblog/plaatjes/groot.gif&#8217; doesn’t exist, while the image is actually loaded and visible???
    Care to have a look at it?

    I have heard scientists have actually created a situation where something exists simultaneously in two places, but haven’t heard about both existing and not existing. Send me the code you were using and where you are putting it and I will play around with it on my site. boulderbill “at” comcast “dot” net

    Thread Starter Jack

    (@moxie)

    Send you the code. Reply here if you didn’t get it somehow.
    Thanks for helping ??

    Glad you got it to work ??

    Thread Starter Jack

    (@moxie)

    And just when this works ‘they’ made some corrections in the templates to the_categoryID() so that it functions again…
    So I guess I’ll be going back to the category_ID(). No extra code needed…

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Hide empty img tags in IE’ is closed to new replies.