Jump to content

header('Content-type: image/jpeg'); not working??


Mateen

Recommended Posts

 

 

hi evry bdy i m new to php

here is my big problem

im trying to display images and resize but header tag in php not working here is my code

 

 

 

 

<?php

 

header('Content-type: image/jpeg');

$new_width = 200;

$new_height = 200;

$files = glob("images/*.*");

//print_r($files);

//for ($i=0; $i<count($files); $i++) {

$filename= $files[0];

print $filename."<br />";

list($width, $height) = getimagesize($filename);

echo "width is".$width." and height is ".$height;

echo '<img src="'.$filename.'" alt="random image" />'."<br /><br />";

$image_p = imagecreatetruecolor($new_width, $new_height);

$image = imagecreatefromjpeg($filename);

imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

imagejpeg($image_p, null, 100);

 

 

//}

 

?>

if i m commenting header in line 3 then it is displaying garbage value

if i m not commenting then it is displaying filename as string ... i wanna resize image

plz hlp me.....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.