Minimum width or height for uploaded pictures Minimum width or height for uploaded pictures
 

News:

CPG Release 1.6.27
change DB IP storage fields to accommodate IPv6 addresses
remove use of E_STRICT (PHP 8.4 deprecated)
update README to reflect new website
align code with new .com CPG website
correct deprecation in captcha

Main Menu

Minimum width or height for uploaded pictures

Started by nambroque, March 02, 2016, 09:23:34 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nambroque

At the moment, in the config area it is possible to set the maximum width or height for uploaded pictures.
It would be very useful to have also the possibility of setting the minimum width or height... would it be possible?
Thanks

(My gallery: http://fotometeo.ame-web.org/index.php)

My gallery:
Galería Fotometeo

Αndré

What exactly should happen if a file undercuts that value? Should it be rejected or upscaled?

nambroque

Quote from: Αndré on March 02, 2016, 10:44:12 AM
What exactly should happen if a file undercuts that value? Should it be rejected or upscaled?

I would prefer them to be rejected
Thanks!
My gallery:
Galería Fotometeo

Αndré

Open include/picmgmt.inc.php, find
if ($CONFIG['read_iptc_data']) {
and above, add
        $CONFIG['min_upl_width_height'] = 400;
        $lang_db_input_php['err_fsize_too_small'] = 'The size of file you have uploaded is too small (it needs to be at least %s x %s)!';
        if (min($imagesize[0], $imagesize[1]) < $CONFIG['min_upl_width_height']) {
            @unlink($uploaded_pic);
            $msg = sprintf($lang_db_input_php['err_fsize_too_small'], $CONFIG['min_upl_width_height'], $CONFIG['min_upl_width_height']);
            return array('error' => $msg, 'halt_upload' => 1);
        }


Please report if it works as expected. I think I'll add this as hidden feature later in cpg1.5.x and it will probably be a config option in cpg1.6.x.

nambroque

I have checked and it seems to work right
It would be great that this is add to cpg1.6x. I suppose the option of setting the minimum will appear in the admin config menu
I mark this topic as solved...
My gallery:
Galería Fotometeo