Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resizing problem

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am trying to resize image - $im.
A picture is not displayed
$im prints ok if I swap the comment tags between the images.
$smallim displays it the copyresized line is omitted.
Could someone please tell me what I am missing

Code:
$smallim = imagecreatetruecolor(100, 100 );
imagecopyresized{$smallim,$im,0,0,0,0,100,100,200,200);


imagejpeg($smallim);
//imagejpeg($im);

Keith
 
don't you want to use imagecreateresampled()?

and where does the $im variable get created?
 
$im has been created from a jpg, had some graphics added to it and then I want to resize it.
I thought imagecopyresize to be the most appropriate, I will look into the two options, thanks.

Keith
 
well all looks fine then. two things:

1. i believe imagecopyresampled is preferred over its resized variant as (as you'd guess) it resamples the image whilst resizing it.

2. your use of curly braces in imagecopyresized seems wrong. i'd use a round bracket instead.

the imagejpeg function will dispay the image on the screen. you have to have sent the right headers. if you want to save the file you also need to supply the path and filename argument.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top