Advanced Search

Results 1 to 6 of 6

Thread: Thumbnail Viewer II locks up if file not found

  1. #1
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thumbnail Viewer II locks up if file not found

    1) Script Title: Thumbnail Viewer II

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...thumbnail2.htm

    3) Describe problem: on mouseover, if the image file is not found then the red wheel just rotates forever with the "loading large file" message. The only way to stop this is to reload the page.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,704
    Thanks
    43
    Thanked 3,133 Times in 3,097 Posts
    Blog Entries
    12

    Default

    Unless I'm missing something, there's not much that can be done if the larger image is missing. If it were missing, reloading the page wouldn't help much. The same thing would happen again as soon as the trigger was activated. Perhaps the larger image is so large (byte size) that it's taking a long time to load. If that's the case, optimize it.

    Oh, and in tests here, you can stop that loading message by activating another trigger for an image that does exist.

    That said, if it is truly missing and you want to skip the loading message, use this modified version of the script:

    Attachment 3893

    If the image is missing, it will show the browser's missing image token in place of the missing image. Any title/caption for that image will also be displayed, and one can go on using the page and the script with no hindrance.

    If you want more help:

    Please post a link to a page on your site that contains the problematic code so we can check it out.
    Last edited by jscheuer1; 05-20-2011 at 06:45 PM. Reason: add detail and modified script
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thumbnail Viewer II locks up if file not found

    [QUOTE=jscheuer1;253355]Unless I'm missing something, there's not much that can be done if the larger image is missing. ...

    John: Thanks for the quick response. The page is still in the test phase behind a firewall. Your script is being used to display a small thumbnail of an image during mouseover of a directory listing. The image URL is actually pointing to a GD PHP function that generates a small copy of the image on the server. If the image is selected, the file name is passed to another function. Display of the full size image is not required. This all works most of the time. I will try your code and get back to you, if necessary.
    // Lance

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,704
    Thanks
    43
    Thanked 3,133 Times in 3,097 Posts
    Blog Entries
    12

    Default

    Whoa, I've done some work with that sort of thing myself. I think the best thing to do would be to figure out, when it fails, why it fails, catch that and have it send some sort of generic image instead.

    On the javascript side, all you can do is render something onerror, you cannot make up for the failure of PHP to produce a valid image.

    BTW, in testing the official version of the script it appeared to only perhaps be an issue in IE. Is that your only target browser? Others would render the content as blank, or (if any) just the title/caption.

    Important Note: I've just updated the script in my previous post with an important addition to prevent memory leaks.
    Last edited by jscheuer1; 05-20-2011 at 06:46 PM. Reason: Add - Important Note
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    May 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John: Re: IE yes problem in IE 9 using GD graphics. Re PHP: a fall back to a valid image file that says "file not found" is provided on error. Working out kinks. Thanks
    // Lance

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    28,704
    Thanks
    43
    Thanked 3,133 Times in 3,097 Posts
    Blog Entries
    12

    Default

    Well, there might not be an error in the GD code, probably isn't since it works most of the time. I suspect it may be more of a matter of how long the browser is willing to wait around. If so, in your GD routine, you would have to supply this generic image not only on error, but also use a timer of some kind that tells it to stop trying after a certain amount of time and to send that generic image instead.

    Alternatively, we could use that generic image as the content that's displayed on javascript error in the browser.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •