Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Thumbnail modifications?  (Read 3319 times)

0 Members and 1 Guest are viewing this topic.

jpettit

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Thumbnail modifications?
« on: November 15, 2004, 12:37:23 am »

Hi there...
Wondering if it's possible to have Coppermine display the thumbnails at different size ratios than they do by default.  Looking to have square (1:1) thumbnails displayed.  Rather than squeeze a 4:3 image into 1:1 i would like it to just show a 1:1 ratio of a portion of the original.  Something along the lines of: http://www.lucky-33.com/photos/
Thanks.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Thumbnail modifications?
« Reply #1 on: November 15, 2004, 07:04:59 am »

this has been asked before, although I'm not sure an answer/hack has been posted. Please search the board for "square thumbnail" or similar.

Joachim
Logged

Casper

  • VIP
  • Coppermine addict
  • ***
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 5231
Re: Thumbnail modifications?
« Reply #2 on: November 15, 2004, 12:32:42 pm »

The only good example of this I can remember is this site lomoblog by rbl.
He was asked but never posted the code to do it.
And he is still using version 1.2.0 which he has integrated with wordpress.
And he has not posted on here since January, so you are unlikely to get his help on this.
« Last Edit: November 15, 2004, 12:38:26 pm by Casper »
Logged
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

owenb

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Thumbnail modifications?
« Reply #3 on: November 12, 2005, 09:47:01 pm »

I was sent a piece of code by a Coppermine user who has got square thumbnails to work exactly as you describe, using a hack that affects how ImageMagick processes images. It apparently goes in the pcmgmt.inc.php file.

However, I couldn't make it work, as I can't get ImageMagick working on my Mac, so I use GD2. I suspect I could make it work on the server I'm about to upload my Coppermine site to, but that's not much use for editing my site offline.

If anyone can suggest how this code might be adjusted to work with GD2, I'd be forever in your debt.

Owen

Code: [Select]
// height/width
    $srcWidth = $imginfo[0];
    $srcHeight = $imginfo[1];
    if ($thumb_use == 'ht') {
        $ratio = $srcHeight / $new_size;
    } elseif ($thumb_use == 'wd') {
        $ratio = $srcWidth / $new_size;
    } else {
        $ratio = max($srcWidth, $srcHeight) / $new_size;
    }
    $ratio = max($ratio, 1.0);
    $destWidth = (int)ceil($srcWidth / $ratio);
    $destHeight = (int)ceil($srcHeight / $ratio);
    $minSide = min($destHeight, $destWidth);
    $xOffset = (int)ceil($destWidth/2-$minSide/2);
    $yOffset = (int)ceil($destHeight/2-$minSide/2);
 
$cmd = "\"".str_replace("\\","/", $CONFIG['impath'])."convert\" -crop {$minSide}x{$minSide}+$xOffset+$yOffset ".str_replace("\\","/" ,$im_dest_file )." ".str_replace("\\","/" ,$im_dest_file );
Logged
Pages: [1]   Go Up
 

Page created in 0.041 seconds with 16 queries.