forum.coppermine-gallery.net
No Support => Feature requests => Topic started by: VanessaP on June 04, 2005, 02:57:39 am
-
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
-
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.
-
http://forum.coppermine-gallery.net/index.php?topic=15866.0