Laprodo
09-22-2007, 01:24 AM
Gallery (http://gallery.menalto.com/) has the possibilty to generate square thumbs (http://codex.gallery2.org/Gallery2:Modules:squarethumb)...
Because I'm not a PHP programmer, I've made a simply hack to generate square thumbs without cropping. Editing includes/functions.php:
function createthumbnail($file)
//...
if($img)
{
$width = imagesx($img);
$height = imagesy($img);
$scale = max($max_width/$width, $max_height/$height);
if($scale < 1)
{
// Hack begin
if($cfgrow['crop'] == "yes" | $cfgrow['crop'] == "12c") {
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
} else {
$new_width = $max_width;
$new_height = $max_height;
}
// Hack ends
Perhaps anybody knows a better way... It would be very nice, if I can create Thumbnails without cropping but filling backgrund with configurable color.
Any suggestion?
Bye
Because I'm not a PHP programmer, I've made a simply hack to generate square thumbs without cropping. Editing includes/functions.php:
function createthumbnail($file)
//...
if($img)
{
$width = imagesx($img);
$height = imagesy($img);
$scale = max($max_width/$width, $max_height/$height);
if($scale < 1)
{
// Hack begin
if($cfgrow['crop'] == "yes" | $cfgrow['crop'] == "12c") {
$new_width = floor($scale*$width);
$new_height = floor($scale*$height);
} else {
$new_width = $max_width;
$new_height = $max_height;
}
// Hack ends
Perhaps anybody knows a better way... It would be very nice, if I can create Thumbnails without cropping but filling backgrund with configurable color.
Any suggestion?
Bye