i am trying to do something like ... sorry i am not so sure how to explain this...
i have 2 images
$image created using imagecreatefromjpeg and $image_thumb created by imagecreatetruecolor then imagecopyresampled.
what i want to do is something like $image = $image_thumb
but $image becomes an invalid image resource... how do i fix this? i can't do a $image = $image_thumb
working with images using GD
Moderator: General Moderators
-
iceangel89
- Forum Commoner
- Posts: 39
- Joined: Mon Jul 02, 2007 7:02 pm
Re: working with images using GD
What are you trying to do? What is it you want to accomplish?
-
iceangel89
- Forum Commoner
- Posts: 39
- Joined: Mon Jul 02, 2007 7:02 pm
Re: working with images using GD
simply put, i want to set a variable = another image variable
why i want to do that is ONLY IF the image is too big, exceeds a certain file size, i want to resize it (to $image_thumb), then set $image = $image_thumb for use for further processing
Code: Select all
$image = $image_thumbCode: Select all
if (image too big) {
//resize image
imagecopyresampled($image_thumb, $image, 0, 0, 0, 0, $new_w, $new_h, $w, $h);
//set $image = $image_thumb ...
$image = $image_thumb ...
}
//.. because i want to use the $image after the if loop
/******** else i can use ...
if (isset($image_thumb)) {
//use $image_thumb
} else {
//use $image
}
****** ... but i think this is a bit more code */