I have the following class
public static function resize_imagejpg($file, $new_width, $new_height) {
list($orig_width, $orig_height) = getimagesize($file);
$width = $orig_width;
$height = $orig_height;
# taller
if ($height > $new_width) {
$width = ($new_height / $height) * $width;
$height = $new_height;
}
# wider
if ($width > $new_width) {
$height = ($new_width / $width) * $height;
$width = $new_width;
}
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($file);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $orig_width, $orig_height);
return $image_p;
}
i'm calling it by
$tmp = Url::resize_imagejpg('uploads/temp.jpg', 300, 300);
then
copy($tmp, 'uploads/thumb.jpg');
but i get the following error
Error on May 10, 2021 21:30PM - copy() expects parameter 1 to be a valid path, resource given in /home....
I know the file is their, i know its an image because i have opened it in an editor but i keep getting that error message
PLEASE HELP!!!