I have this script:
function createThumb($source, $thumb_width=100)
{
$fl = dirname($source).'<br>';
$new_name = 'thumb_'.basename($source);
$img = imagecreatefromjpeg($source);
$width = imagesx($img);
$height = imagesy($img);
$new_width = $thumb_width;
$new_heght = floor($height * ($thumb_width / $width));
$tmp_name = imagecreatetruecolor( $new_width, $new_heght );
imagecopyresized($tmp_img, $img, 0, 0, 0, 0, $new_width, $new_heght, $width, $height);
imagejpeg($tmp_img, $fl.DIRECTORY_SEPARATOR.$new_name);
}
All data works fine. I echo every step to imagecopyresized
where I get this warning.
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /www/mdkbg.com/keasport/root/admin/parsing_vars.php5 on line 41
what could be the problem? I've changed the folder permission to 755 and I use php5 file tipes.
should read: