Mailinglisten-Archive |
Markus Post wrote:
> --Hier der Codeschnippsel
>
> $imgSrc = imagecreatefromjpeg("testbild3.jpg");
> echo "Image load ".($imgSrc ? "success" : "failed")."<br>";
>
> --Und der Output:
> Warning: imagecreatefromjpeg: 'testbild3.jpg' is not a valid JPEG
> file in /kunden/purematic.com/purematic.de/bsp.php on line 12 Image
> load failed
Öh, äh: Sooo komplex ist der Source ja nicht, dass sich da
größere Fehler verstecken könnten ;-)
Das hier fällt den User-Contributed-Notes dazu ein,
trifft irgendwas bei Dir zu?
- imagecreatefromjpeg doesn't seem to support cmyk-jpgs :-(
- did you found that sometimes it hang the php when
imagecreatefromjpeg() run on bad JPEG. I found that this is cause by the
JPEG file U used dont have EOI (end of image)
the FF D9 at the end of your JPEG
JPEG image should start with 0xFFD8 and end with 0xFFD9
// this may help to fix the error
function check_jpeg($f, $fix=false ){
# [070203]
# check for jpeg file header and footer - also try to fix it
if ( false !== (@$fd = fopen($f, 'r+b' )) ){
if ( fread($fd,2)==chr(255).chr(216) ){
fseek ( $fd, -2, SEEK_END );
if ( fread($fd,2)==chr(255).chr(217) ){
fclose($fd);
return true;
}else{
if ( $fix && fwrite($fd,chr(255).chr(217)) ){return true;}
fclose($fd);
return false;
}
}else{fclose($fd); return false;}
}else{
return false;
}
}
Gruss,
Andreas
php::bar PHP Wiki - Listenarchive