Question : PHP: Output Jpeg on die

The following code outputs a GIF image upon death.  Now I want it to output a 1px jpg image upon death.

I want the code to be changed so it returns a JPEG image instead of a GIF image.

1:
2:
3:
4:
header( "Content-type:  image/gif"); 
$error_image = sprintf("%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c",71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);

$this->myImage = imagecreatefromgif($this->imgSrc) or die ($error_image);
Attachments:
 
1.jpg (830 bytes) (File Type Details) 
1px jpg
1px jpg
 
Related Solutions: PHP: Output image on die

Answer : PHP: Output Jpeg on die

I'm guessing what you're doing or maybe not.
But I think this could help...
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
$img = @imagecreatefromgif($this->imgSrc);

if(!$img) {
	header( "Content-type:  image/jpeg");
	$img = imagecreatefromjpeg($jpegImage);
	imagejpeg($img);
}
else {
	header( "Content-type:  image/gif");
	$this->myImage = $img;
	imagegif($img);
}

imagedestroy($img);
Random Solutions  
 
programming4us programming4us