Webmastersite.net
Register Log In

limiting uploaded images, byte allowance
changed usergroups, still no limits

Comments on limiting uploaded images, byte allowance

knotworking
Experienced

Usergroup: Customer
Joined: Mar 31, 2004

Total Topics: 20
Total Comments: 83
Posted May 06, 2005 - 7:05 AM:

First, let me say this is a great gallery. I'm chompin' at the bit to get it published. Sorry if I'm posting like crazy lately but, I'm determined to get this integrated (if I had this gallery 3 years ago when I started my site, I would have been a LOT better off).

Problem I'm encountering today is limiting images and size restrictions on my usergroups. I've set all the various limits on my Member group #2 but, none of them are taking effect. Members can still post as many images as they want. I did notice in my 'totalbytes' dB field was displaying 0 in profiles that I had several images uploaded into.

What am I doing wrong (today)??
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 06, 2005 - 11:40 PM:

Confirmed that totalbytes isn't being added to. A fix is needed in functions.php. Replace
 if (($filesize < $settings->filesize) && ($allowed))
{
// move file to real upload directory
if ($cat && $switches[attachmentstree]) createmissingdirs($target_file); // create attachments subdirectories we may need
if (move_uploaded_file($upload_temp, $target_file))
{
$uploaded = $upload_file;
}
}
return $uploaded; // returns file name if it worked, or false if failed
}
with
 if (($filesize < $settings->filesize) && ($allowed))
{
// move file to real upload directory
if ($cat && $switches[attachmentstree]) createmissingdirs($target_file); // create attachments subdirectories we may need
if (move_uploaded_file($upload_temp, $target_file))
{
$uploaded = $upload_file;
}
}
if ($uploaded && $thismember->id > 0)
{
$thismember->totalbytes += $filesize;
$thismember->update('totalbytes');
}
return $uploaded; // returns file name if it worked, or false if failed
}
knotworking
Experienced

Usergroup: Customer
Joined: Mar 31, 2004

Total Topics: 20
Total Comments: 83
Posted May 07, 2005 - 8:40 AM:

OK, made that code change but, still getting the goose egg '0' for totalbytes. I do notice that the 'images' count is incrementing correctly. If it's easier to get the image # limitations working, that would serve my purposes just as well as the totalbytes limitation.
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 08, 2005 - 1:55 AM:

I've uploaded the fix of both (though the former is just what I posted that you say doesn't work for you, but does for me). Overwrite your PHP files with the new ones.
knotworking
Experienced

Usergroup: Customer
Joined: Mar 31, 2004

Total Topics: 20
Total Comments: 83
Posted May 08, 2005 - 8:45 AM:

"I've uploaded the fix of both (though the former is just what I posted that you say doesn't work for you, but does for me)."

Was there another fix I'm missing? Looking at the code the only fix I can make out is the totalybyte count (not the images allowed per member).

It's still not working for me. I've overwritten several times, redone and syntax checked the code several times but, still no 'totalbyte' count. 'Images' is going up and down correctly with adding/deleting member images.

I'm using the most recent version 2.15. Any ideas??
(looking at the post history below, I notice a winking smiley in the code right after:
update('totalbytes'
could that be something)
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 08, 2005 - 8:33 PM:

The usergroup permission for images per day and total images did not work until my post this morning, but it does work in the version I uploaded at that time.
knotworking
Experienced

Usergroup: Customer
Joined: Mar 31, 2004

Total Topics: 20
Total Comments: 83
Posted May 08, 2005 - 9:02 PM:

oK, I went ahead and uploaded the latest gallery (spent all morning trying to get things back to where I was pre-update).

The totalbyte is indeed incrementing now. But, here's a few problems I'm having:

-Limiting member images based on totalbytes is not working.

-Totalbytes count is not decreasing when an image is deleted. It's supposed to, isn't it? (if not, limiting member uploads based on this field would be useless)

-Limiting total member images is not working.

Limiting images per day is working properly. Unfortunately, that's the field that does me the least good. I've tried filling all limitation fields, only 1 field, and selecting 2 out of 3 with no luck. The only function that seems to be working is the daily limit.

...one step forward, two steps back....
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted May 10, 2005 - 2:38 AM:

Uploaded another revision. The limit works now, but I'm not sure about the total bytes deduction.
knotworking
Experienced

Usergroup: Customer
Joined: Mar 31, 2004

Total Topics: 20
Total Comments: 83
Posted May 10, 2005 - 7:09 AM:

Yes, that fixed it. The total images uploaded limitation is working fine. The totalbyte limitation is working, as well.

One thing I note on the totalbyte count is that it does not deduct the same amount as it adds (I delete all images from an album but, a residual byte count remains). I don't have any resizing going on during upload but, I figure there's got to be a reduction in uploaded file size or something that reduces the final file size.

It would be the best situation but, I don't think it would be possible to limit member uploads based on totalbyte count. The residual byte count from members updating and removing pictures would compound over time. I don't think this is fixable (right?).

The total image limitation will work and, is easier to explain to members, anyways. Thanks for fixing the functions!
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.