if somebody needs cropped thumbnails, you can get it)
the original image is centered, then cropped to the short side, then resized to the thumbnail size wich is set in the config.inc.php
find files
replace.php and
upload.php in assets\modules\evogallery
find the line
resizeImage($target_file, $target_thumb, $params['thumbSize'], $params['thumbQuality']); // Create and save thumb
and replace it with
cropImage($target_file, $target_thumb, $params['thumbSize'], $params['thumbQuality']); // Create and save thumb
do it in both files.
then in the end of both files insert the code (before ?> offcourse)) :
/**
* Crop a given image
*/
function cropImage($filename, $target, $target_size = 110, $target_quality = 76)
{
$info = @getimagesize($filename); // Determine whether file is an image using getimagesize()
if ($info)
{
if ($info[2] > 3) // Use Imagemagick to convert other filetypes
{
/*
// SWF, PSD, BMP, TIFF (intel + motorola)
if ($info[2] == 4 || $info[2] == 5 || $info[2] == 6 || $info[2] == 7 || $info[2] == 8)
{
$cmd = $this->convert . " \"" . addslashes($filename) . "\" -quality $target_quality -quiet -resize $target_size" . "x" . "$target_size \"jpeg:" . addslashes($target) . "\"";
shell_exec($cmd);
}
*/
}
else // Use the GD library to convert jpeg, gif, and png images
{
switch ($info[2]) // Check image type
{
case 1:
$img = @imagecreatefromgif($filename);
break;
case 2:
$img = @imagecreatefromjpeg($filename);
break;
case 3:
$img = @imagecreatefrompng($filename);
break;
}
if (!$img) return false; // Incompatible type
$width = imageSX($img);
$height = imageSY($img);
if (!$width || !$height) return; // Invalid width or height
$ratio = ($width / $height);
$new_height = $height;
$new_width = $width;
$x_start = 0;
$y_start = 0;
if ($width>$height)
{
$size = $height;
$x_start = ceil(($width-$size)/2); //horizontal start
}
if ($height>=$width)
{
$size = $width;
$y_start = ceil(($height-$size)/2); //vertical start
}
$new_img = imagecreatetruecolor($target_size, $target_size);
if (!@imagefilledrectangle($new_img, 0, 0, $target_size, $target_size, 0)) return false; // Could not fill image
if (!@imagecopyresampled($new_img, $img, 0, 0, $x_start, $y_start, $target_size, $target_size, $size, $size)) return false; // Could not resize image
imagejpeg($new_img, $target, $target_quality); // Save resulting thumbnail
imagedestroy($new_img);
}
}
}
enjoy)
p.s. sorry for my english