coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: New City Vegas on August 10, 2008, 04:22:48 AM

Title: Automatically convert thumbnails to PNG
Post by: New City Vegas on August 10, 2008, 04:22:48 AM
I've been playing with Coppermine only for about an hour so excuse me if I missed the obvious somewhere.

I am using Coppermine in a VERY limited way.  To provide user access to 16x16 resized icons for a new web project.

Coppermine seems to have all I need (and a whole lot more) but what I would really like is to have all uploaded images and/or thumbnails automatically converted to PNG format.

The custom PHP code change should be easy if I can find it.  Maybe you can help.

BTW, yes my host has ImageMagick already installed.

http://ideaboomer.com/gallery/thumbnails.php?album=1

Bob in Las Vegas






Title: Re: Automatically convert thumbnails to PNG
Post by: New City Vegas on August 10, 2008, 04:34:53 AM
And automatic upload resizing to 16x16 pixels would be plus.  Code file location? 
Title: Re: Automatically convert thumbnails to PNG
Post by: Joachim Müller on August 10, 2008, 08:21:30 AM
Coppermine doesn't convert jpeg or gif files into png. That's something many desktop apps like IrfanView can do for you easily.
Not sure what you're asking for, but coppermine doesn't have the capabilities to merge several pics into one.
Title: Re: Automatically convert thumbnails to PNG
Post by: New City Vegas on August 10, 2008, 09:53:41 AM
I never mentioned merging so I don't know how that came up.  That is not something I have any interest in.

Put simply: [ SOURCE .jpg or .gif or .bmp or .tif INPUT ] ----> [ DESTINATION thumbnail .png OUTPUT ]

In the CPM config "File and Thumbnail Advanced Settings", it specifically references Imagemagick's "convert" utility (presumably for resizing).  This (CPM-embedded?) convert utility could just as easily change output format (as indicated at the URL below).  It should just be finding the right PHP function code to modify.

http://www.imagemagick.org/script/convert.php

I have used the Linux 'convert' frequently to change .xwd (screen capture) files into intermediate .jpg files.  However, without proper parameters, ImageMagick's 'convert' is not very filesize-efficient.  I assume with the right parameters it can be made to employ proper compression.  With 16x16 icon files, absolute filesize is not a major concern.


Title: Re: Automatically convert thumbnails to PNG
Post by: Nibbler on August 10, 2008, 05:33:18 PM
You can simply hardcode it here I expect in upload.php (for multi file upload mode) or db_input.php (single file upload mode)


        // Create a unique name for the uploaded file
        $nr = 0;
        $picture_name = $matches[1] . '.png';
        while (file_exists($dest_dir . $picture_name)) {
            $picture_name = $matches[1] . '~' . $nr++ . '.png';
        }


ImageMagick only of course.