Minimum FIle Size option Minimum FIle Size option
 

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

Minimum FIle Size option

Started by VanessaP, June 04, 2005, 02:57:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

VanessaP

Hi Everyone!

I run a photo competition, where the winning photos will be made into a Calendar.
In config you can set what the maximim file size is, but I'd like to be able to set a minimum, too.

I've found the file that checks that the image being uploaded is not larger than it should be, in
db_input.php



   // Check that picture size (in pixels) is lower than the maximum allowed
        if (max($imginfo[0], $imginfo[1]) > $CONFIG['max_upl_width_height']) {
            $max = $CONFIG['max_upl_width_height'];
//            cpg_die(ERROR, sprintf($lang_db_input_php['err_fsize_too_large'], $CONFIG['max_upl_width_height'], $CONFIG['max_upl_width_height']), __FILE__, __LINE__);
            // Check that picture file size is lower than the maximum allowed
        } else {
            $max = max($imginfo[0], $imginfo[1]);
        }
        if (!resize_image($uploaded_pic, $uploaded_pic, $max, $CONFIG['thumb_method'], '')) {
            @unlink($uploaded_pic);
            cpg_die(ERROR, "This is not a image or image has errors", __FILE__, __LINE__);
        }
        $imginfo = getimagesize($uploaded_pic);
        if (filesize($uploaded_pic) > ($CONFIG['max_upl_size'] << 10)) {
            @unlink($uploaded_pic);
            cpg_die(ERROR, sprintf($lang_db_input_php['err_imgsize_too_large'], $CONFIG['max_upl_size']), __FILE__, __LINE__);


Is there any way to make a version of max_upl_width_height option in config that is min_upl_width_height so that ONLY photos larger than 1280 pixels wide will be successfully uploaded?

Thanks in advance for any help,

Vanessa

kegobeer

Switch > to < for the pixel size comparison, then go into your language file and change the text for err_imgsize_too_large.  Unless you want both a min and a max, then you could always just hardcode it and change the error messages to include either too large and too small: "The dimensions are either too large or too small" or something along those lines.

if (max($imginfo[0], $imginfo[1]) > $CONFIG['max_upl_width_height'] || max($imginfo[0], $imginfo[1]) < 1280)

Untested, but give it a try.

And I don't think you are talking about file size, you mean dimension size.  I don't think having a minimum file size required is necessary.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

Joachim Müller