convert image.gif[0] image1.gif
but it won't work if I do this
convert image.gif[0] image.gif
this made me block gif upload for my users, but now some users found a glitched which they can hide a gif image by changing .gif to .jpeg and it would upload to the server without noticing it.
this is the code I have in my php website
Code: Select all
$image_name = $userName."_".$t.".".$extension;
$image_name = str_replace (" ", "", $image_name); //I delete any blank space because it seems imagemagick doesn't like that and wont create thumbnail
$image_name_thumb = $userName."_".$t."_thumb.".$extension;
$image_name_thumb = str_replace (" ", "", $image_name_thumb);
//the new name will be containing the full path of the image where it will be stored (images folder)
$new_name = "user/".$image_name;
//we verify if the image has been uploaded, if it didn't php will show me an error
$copied = copy($_FILES['image']['tmp_name'], $new_name);
//creating the pic and also thumbnail
exec("convert user/$image_name -resize 500x800\> -quality 80 -compress JPEG user/$image_name"); //<---- this is where the image gets converted it, but when I put [0] in front of $image_name it doesn't respond at all
//creating thumbnail
if(!$imgsize = getimagesize($new_name)){//if we cant get size show there was an error
$success .= "<div id=\"fmsg\"><strong>Your picture contains errors.</div>";
}else{
if ($imgsize[0] > $imgsize[1] ) {
$imgsize = "x100";
} else {
$imgsize = "100x";
}
$cmd = "-size 300x300 user/$image_name -resize $imgsize -gravity center -crop 100x75+0+0 +repage";
exec("convert $cmd user/$user_folder/$image_name_thumb");
}
thanks.