When I submited this, i recieved te following error
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in /home/bensboxc/public_html/volkslove/regclassified.php on line 143
line 143 is '''' $width,$height);''''
any suggestions where im going wrong, thanks!
Last edited by wirehopper; 03-06-10 at 11:12 AM.
Reason: PHP tags
if (isset($_FILES['image']))
{
$v=$_FILES['image'];
if ($v['tmp_name']!=='')
{
$parse=pathinfo($v['name']);
if (isset($parse['extension']))
{
$tmp_image='tmp/image.gif';
`rm $tmp_image`;
system ('convert '.escapeshellarg($v['tmp_name']).' -thumbnail 200 '.escapeshellarg($tmp_image));
}
else
{
echo 'No extension';
exit();
}
}
Linux - not Windows.
Could you explain this a bit more, just so I can understand the functions that I need as I can't quite work out where it is the image dimensions are being changed, and how i would implement this into my current script
Cheers for getting back to me though!
system ('convert '.escapeshellarg($v['tmp_name']).' -thumbnail 200 '.escapeshellarg($tmp_image));
convert is the command for ImageMagick
The first filename is the input file. In this case, it's the file, as uploaded to the server and present in the server's tmp directory.
-thumbnail 200 means resize the image as a thumbnail, 200px wide, preserve the attribute ratio
Second filename is the destination file.
The example may be more useful to you for the upload process of getting the file input and interpreting it. I never use PHP's image processing libraries, I think the command line is easier.