Как я могу проверить, является ли изображение в формате PNG, GIF, TIFF и JPG, и если это так, создайте миниатюру и сохраните ее в файле большого пальца.
Пока что я могу проверить и сохранить для JPEGimages.
Вот код ниже.
<?php
//Name you want to save your file as
$save = 'members/3/images/thumbs/thumb-pic.jpg';
$file = 'members/3/images/pic.jpg';
echo "Creating file: $save";
list($width, $height) = getimagesize($file) ;
if ($width >= 180){
$modwidth = 180;
$modheight = ((180.0/$width) * $height);
} else {
$modwidth = $width;
$modheight = $height;
}
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
// Here we are saving the .jpg, you can make this gif or png if you want
//the file name is set above, and the quality is set to 100%
imagejpeg($tn, $save, 100) ;
?>