I have the below line of code which I am trying to use after an image is uploaded in order to resize the image.
I have confirmed my image does get uploaded correctly so the image file is in the correct location however I keep getting an error

The line of code I am trying to use is

imagecopyresampled($tmp,$atarget_path,0,0,0,0,$newwidth,$newheight, $width,$height);  

I confirmed the $atarget_path holds the correct value in the form of ./img/avatars/testone.jpg and when I go to that folder on my server I see the testone.jpg file . So I am not sure why I am getting the below error messgage

Warning: imagecopyresampled() expects parameter 2 to be resource, string given in /home/****/public_html/****/avatarupload.php on line 84

Any suggestions?

4 Years
Discussion Span
Last Post by jayreis

Ahh ya the string I am passing is the full file path to the image so like
home/public_html/img/testimg.jpg is what I am passing imagecopyresampled but guess I need to make it just be the image name.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.