Jump to content

limiting image size upload in the admin


Ben
 Share

Recommended Posts

I was wondering if anyone had experience with placing a threshold on the size of an upload using the images field. It doesn't matter if the constraint is by dimensional/pixel area or by kilobytes, the point is to only to keep gigantic camera jpegs off the system. Limiting the global php upload maximum isn't an option because the site needs to handle pdfs and other media. While the optimum strategy would resize the image programatically on upload (if it exceeds certain conditions), throwing an error would also be fine.

Poking around InputfieldImage.module, I'm seeing maxWidth and maxHeight properties (applied in ___fileAdded the method) that look like they would be perfect, but I can't figure out to apply the settings to the field.

Thanks!

Link to comment
Share on other sites

  • 6 months later...

Hmm. I just implemented this limit (set width to 850 so images 851 and wider would be re-sized down at upload).

Now when I add an image of over 851px wide it appears to barber-pole it's way up to 100% loaded but then never displays the image.

I removed the restriction and now normal service is resumed and images are able to be uploaded again. Any ideas anyone?

Link to comment
Share on other sites

Hi Alan, I have tried it here and it works!

Does you try it online or local?

Maybe one/some needed folder isn't availbale or not writeable.

Any entry in errors.log?

Turn on debug?

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...