RAH Posted August 16, 2007 Share Posted August 16, 2007 Hi, Does anyone know what would cause the following? http://haserve.com The thumbnails will randomly fail to load in IE7 and FireFox. Yet in Opera they work 100% of the time. It's quite a mystery and has kept me puzzled for some time...lol Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/ Share on other sites More sharing options...
cooldude832 Posted August 16, 2007 Share Posted August 16, 2007 try and figure out the image types on those, you might be forcing non jpgs to be jpgs Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325308 Share on other sites More sharing options...
RAH Posted August 16, 2007 Author Share Posted August 16, 2007 Good idea but that's not the case. You can upload 10 jpgs and 3 of the thumbnails will randomly fail to load. I mean if you refresh enough you can sometimes get thumbnails which previously failed to load working again. Also it works 100% in Opera all the time. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325313 Share on other sites More sharing options...
cooldude832 Posted August 16, 2007 Share Posted August 16, 2007 try 10 of the same exact images, your script might have it in there Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325317 Share on other sites More sharing options...
RAH Posted August 16, 2007 Author Share Posted August 16, 2007 Done - you can check the site. Same issue - random thumbnails fail to load in IE7 and FireFox yet work in Opera. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325322 Share on other sites More sharing options...
cooldude832 Posted August 16, 2007 Share Posted August 16, 2007 can we see the thumb generating script. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325330 Share on other sites More sharing options...
RAH Posted August 16, 2007 Author Share Posted August 16, 2007 Hi, Here's two files, think they are relevant: <? set_time_limit(0); function ImageCopyResampleBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) { for ($i = 0; $i < 4; $i++) { // get pallete. Is this algoritm correct? $colors = ImageColorsForIndex ($src_img, $i); ImageColorAllocate ($dst_img, $colors['red'], $colors['green'], $colors['blue']); } $scaleX = ($src_w - 1) / $dst_w; $scaleY = ($src_h - 1) / $dst_h; $scaleX2 = $scaleX / 2.0; $scaleY2 = $scaleY / 2.0; for ($j = $src_y; $j < $dst_h; $j++) { $sY = $j * $scaleY; for ($i = $src_x; $i < $dst_w; $i++) { $sX = $i * $scaleX; $c1 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, (int) $sX, (int) $sY + $scaleY2)); $c2 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, (int) $sX, (int) $sY)); $c3 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, (int) $sX + $scaleX2, (int) $sY + $scaleY2)); $c4 = ImageColorsForIndex ($src_img, ImageColorAt ($src_img, (int) $sX + $scaleX2, (int) $sY)); $red = (int) (($c1['red'] + $c2['red'] + $c3['red'] + $c4['red']) / 4); $green = (int) (($c1['green'] + $c2['green'] + $c3['green'] + $c4['green']) / 4); $blue = (int) (($c1['blue'] + $c2['blue'] + $c3['blue'] + $c4['blue']) / 4); $color = ImageColorClosest ($dst_img, $red, $green, $blue); ImageSetPixel ($dst_img, $i + $dst_x, $j + $dst_y, $color); } } } $a=300; $file=$_GET['src']; $is = getimagesize ($file); $w0 = $is[0]; $h0 = $is[1]; //if($w0 >= $h0){ $w1 = $a; $h1 = ceil( $a * $h0 / $w0 ); } // else { $h1 = $a; $w1 = ceil( $a * $w0 / $h0 ); } $w1=$a; $h1=ceil($a*$h0/$w0); if(strtolower(substr($file,-3))=="jpg"){ $src = ImageCreateFromJPEG($file); $type="jpg"; } if(strtolower(substr($file,-3))=="gif"){ $src = ImageCreateFromGIF($file); $type="gif"; } if(strtolower(substr($file,-3))=="png"){ $src = ImageCreateFromPNG($file); $type="gif"; } $dst=ImageCreate($w1,$h1); $tmp=ImageColorAllocate($dst,255,255,255); $transp=ImageColorAt($dst,1,1); ImageColorTransparent($dst,$transp); $transp=ImageColorAt($src,1,1); ImageColorTransparent($src,$transp); ImageCopyResampled($dst,$src,0,0,0,0,$w1,$h1,$w0,$h0); header("Pragma: no-cache"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Last-Modified: " . date("D, d M Y H:i:s") . " GMT"); header("Content-type: image/jpeg"); ImageJPEG($dst,$file,70); ?> <? $open = $_GET['open']; $file_self = sqlr("SELECT thumbnail FROM `file_items` WHERE md5(id)='".$open."'"); //$file_url = sqlr("SELECT link FROM `files` WHERE md5(id)='".$open."'"); $file_path="thumbnails/$file_self"; $download_size = filesize($file_path); header("Content-type: application/x-download"); header("Content-Disposition: attachment; filename=$file_self;"); header("Accept-Ranges: bytes"); header("Content-Length: $download_size"); readfile($file_path); ?> Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325341 Share on other sites More sharing options...
tibberous Posted August 16, 2007 Share Posted August 16, 2007 I'd say bad headers if I had to guess, hard to tell without viewing the code. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325357 Share on other sites More sharing options...
RAH Posted August 16, 2007 Author Share Posted August 16, 2007 Bad headers where? In the HTML template? Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-325361 Share on other sites More sharing options...
RAH Posted August 20, 2007 Author Share Posted August 20, 2007 Hi, Here's the relevant bits of the template coding: <head> <style type="text/css"> .style3 { color: #FF0000; } .style4 { text-align: center; line-height: 100%; margin-top: 0; margin-bottom: 0; } .style5 { text-align: center; } </style> </head> <table width="100%" border="0" cellspacing=0 cellpadding=0> <tr> <td valign=top width="500"> <H3 class=style5> <A href="%=link_mode%"> <IMG alt="%=title%" src="%=link_thumbnail%" border=0></A></H3> <H3 class=style5> Any ideas? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/65158-random-failures-to-load-thumbnails-ie7-firefox/#findComment-328442 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.