I have two image resources variables: imgResource and imgNew.
After the image is resized I want to do a little clean up and copy the newly resized image resource from imgNew to imgResource and then destroy imgNew.
However the following code seems to pass by reference.
Thus when I destroy imgNew I also destroy imgResource.
I tried Clone() and (clone) but imgResource isn't an object neither is imgNew and it returns an error.
My question:
What are my options for copying?
Here's the snippet in question.
Code: Select all
if (@imagecopyresampled ( $this->img->getImageNew(), $this->img->imgResource, 0, 0, 0, 0, $newWidth, $newHeight, $this->img->getImageWidth(), $this->img->getImageHeight() )){
$this->img->imgResource = $this->img->imgNew;
imagedestroy($this->img->imgNew);
}Thanks