Keep thumb and normal pictures at max aspect Keep thumb and normal pictures at max aspect
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Keep thumb and normal pictures at max aspect

Started by je79ayps, April 03, 2004, 10:26:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

je79ayps

I would like that thumbs only are 75px heigh so that it doesn't change the design regarding the width and height of the tables. I would like my normals only to be 640px max aspect.

As I see this is not possible when I have chosen "height" in the config. Becuase the my normal pictures could end being more than 640px in width.

Either I should choose "max aspect" and live with the thumbs being 75px overall. Isn't this correct?

Here's my config part:

Pictures and thumbnails settings
Quality for JPEG files: 100
Max dimension of a thumbnail: 75px
Use dimension ( width or height or Max aspect for thumbnail ): height
Create intermediate pictures: yes
Max width or height of an intermediate picture: 640
Max size for uploaded pictures (KB): 512kb
Max width or height for uploaded pictures (pixels): 1280

je79ayps


hyperion

You can hardcode the settings in include/picmgmt.inc.php.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

je79ayps

Thanks, but is it line 25 I should fool around with:
    $thumb = $CONFIG['fullpath'] . $filepath . $CONFIG['thumb_pfx'] . $filename;

hyperion

No, that is the file path. You want the resize functions, which begin on 28.

   
if (!file_exists($thumb))
        if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
            return false;

        if (max($imagesize[0], $imagesize[1]) > $CONFIG['picture_width'] && $CONFIG['make_intermediate'] && !file_exists($normal))
            if (!resize_image($image, $normal, $CONFIG['picture_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))
                return false;
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

je79ayps

OK, but how do I set the pixels I want?

I guess it's the $CONFIG['thumb_width'] I should concentrate about but should I just make somthing like: $CONFIG['75']?

But it isn't really the width I want to set - it's the height so that the thumbs only are 75px in height.

hyperion

Change:


        if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], $CONFIG['thumb_use']))


to:


        if (!resize_image($image, $thumb, $CONFIG['thumb_width'], $CONFIG['thumb_method'], 'ht'))


It says $CONFIG['thumb_width'], but it is really just the length for the dimension specified in $CONFIG['thumb_use'].

Then set the Config console to max aspect. Your thumbs will get resized by height, and your intermediates will get the max aspect treatment.  Pixels for both intermediates and thumbs should be specified in the Config console.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

je79ayps

Okay, got it - but it doesn't seem to work.

If you look at http://www.brutaldeluxe.dk the horistonal picture is only 75px in width but I want this to be 100 px and then the height should be 75 px.

Config:

Pictures and thumbnails settings
Quality for JPEG files    80
Max dimension of a thumbnail *   75
Use dimension ( width or height or Max aspect for thumbnail )*   Max Aspect
Create intermediate pictures   Yes
Max width or height of an intermediate picture *    640
Max size for uploaded pictures (KB)    1024
Max width or height for uploaded pictures (pixels)    2048

hyperion

Hmmm . . . This may require more than that. Look at the thumbnails using the FTP client (no browsers) to see if the files were actually resized correctly.  This may be an image tag issue.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

je79ayps

On a note - the 2 pictures were uploaded after I made the changes to the code.

If I look at the pictures they have the rigth dimension: 56x75 and 100x75 - so that should be allright...

je79ayps

I guess I want the same function as height sizing on thumbs in categories.

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.upit.dk%2Ffiles%2FSNAG-0000.jpg&hash=6190024bca6b263a91375fd299d668b542a30bcb)

And the film strip:

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.upit.dk%2Ffiles%2FSNAG-0001.jpg&hash=4c41629af33749ee3923f32bd69a38a1c591f5ff)

Hope this is possible...

hyperion

Yes, this is possible. I am too busy to work on this right now, but the issue is an HTML image tag issue.  You need to look in thumbnails.php and /include/functions.inc.php.  The relevant functions are display_thumbnails and compute_image_geom. You will need to add an argument to the function to return a custom image geometry for thumbnails instead of relying on the max aspect setting.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

je79ayps

OK, thanks for your help so far hyperion!

I'll try and mess around with the two files - we can't be that far from the goal since the thumbs are created correctly, so...

Perhaps gaugau or casper can be of assistance for the last part?

Casper

I wish I could help, but it's all alien to me.  The other people who really could help, other than Gaugau, such as Tarique, Omni, Nibbler and the other devs, are all quite busy getting 1.3 ready for stable release at the moment.
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

je79ayps

OK, no problem - I'll live with the "problem".

Perhaps it could be a feature in the 1.3 version. To use different scaling for the normal and thumb pictures that is.

Joachim Müller

sorry, no additional features for cpg1.3.0 - we had a feature freeze and are within the pre-release beta testing phase.

GauGau