Advanced search  


cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Minimum FIle Size option  (Read 3914 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Minimum FIle Size option
« 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

Code: [Select]

   // 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'], '')) {
            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)) {
            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,

« Last Edit: June 05, 2005, 10:49:24 pm by GauGau »


  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: Minimum FIle Size option
« Reply #1 on: June 04, 2005, 03:22:50 am »

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.

Code: [Select]
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

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
Pages: [1]   Go Up

Page created in 0.016 seconds with 19 queries.