Ciao a tutti, ho un probema con la visualizzazione dei thumbnail delle immagini sul mio server.
Uso una funzione che si avvale delle solite librerie GD per fare il resize dell'immagine:
questa funzione mi spara fuori correttamente il thumbnail, se provo con resizeImage("immagine.jpg") tutto ok.codice:function resizeImage($filename) { $width = 50; $height = 50; header('Content-type: image/jpeg'); list($width_orig, $height_orig) = getimagesize($filename); if ($width && ($width_orig < $height_orig)) { $width = ($height / $height_orig) * $width_orig; } else { $height = ($width / $width_orig) * $height_orig; } $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imagejpeg($image_p, null, 100); }
I problemi nascono quando devo visualizzare uan serie di thumbnails i cui URL sono ricavati da una query MySQL.
Ho notato che se faccio cosi':
Il thumbnail mi viene visualizzato in ASCII!!!!!codice:$subQuery = "SELECT * FROM items WHERE tipo=1"; $subResult = mysql_query($subQuery, $db); while ($subRow = mysql_fetch_array($subResult)) { resizeImage ("../".$subRow[url]); echo $subRow[url]; }
Se invece non inserisco l'ECHO, il thumbnail mi viene visualizzato normalmente!!!
Posibile!?!?!?!
Mi saltano fuori cose del genere:
ÿØÿàJFIFÿþ|Õµ_ÍŒü];xWÃ:¦ØØèS][M6¥âA¿»–MMŠiìãÛ ”¶KÛ,Ê}ƒãŸí«û<þÍ7‰¥|bñkxoU›C›Ä°i‘xoǺ_̺ÐɨyÚ W‚ï,£€OÛ§y’L_ +Kòæ/þ


Rispondi quotando
