mirror of
https://github.com/Fluffy-Bean/image-gallery.git
synced 2024-12-29 10:56:12 +00:00
Fixed Gif previews
This commit is contained in:
parent
29eda68d8f
commit
417a0cb959
17
upload.php
17
upload.php
|
@ -68,7 +68,22 @@
|
|||
if (move_uploaded_file($_FILES['image']['tmp_name'], $image_path)) {
|
||||
// Make thumbnail
|
||||
$image_thumbnail = new Imagick($image_path);
|
||||
$image_thumbnail->resizeImage(300,null,null,1,null);
|
||||
// Get image format
|
||||
$image_format = $image_thumbnail->getImageFormat();
|
||||
// If image is gif
|
||||
if ($image_format == 'GIF') {
|
||||
$image_thumbnail = $image_thumbnail->coalesceImages();
|
||||
foreach ($image_thumbnail as $frame) {
|
||||
$frame->thumbnailImage(300, null);
|
||||
$frame->setImagePage(300, null, 0, 0);
|
||||
}
|
||||
// Put image back together
|
||||
$image_thumbnail = $image_thumbnail->deconstructImages();
|
||||
}else{
|
||||
// Image not gif
|
||||
$image_thumbnail->resizeImage(300,null,null,1,null);
|
||||
}
|
||||
// Save image
|
||||
$image_thumbnail->writeImage("images/thumbnails/".$image_basename);
|
||||
|
||||
header("Location:upload.php?r=success");
|
||||
|
|
Loading…
Reference in a new issue