Constrain image upload dimensions and delete original
Hi,
I've maybe missed this somewhere, but I wondered if there's a way currently to save an instance of a dimensionally-constrained image upon saving to the media section, then deleting the original. In a practical example, what I'm trying to do is prevent clients uploading photos directly from their camera into the media section of their website at their original size. Ideally what I want to do is to constrain each image to a maximum of 800px in the maximum dimension, save this resized/constrained version (possibly optimise at this point too) then delete the original.
I know I could use imagegen or similar to resize images dynamically but I'd rather not be storing original large/high-res image that are never required at that resolution. I'd also like the customer not to have to worry about resizing manually before upload.
I think you should use the API and hook in to the some of the events to do the resizing before the image is being saved so you don't risk having large images take up a lot of disk space.
So in C# you should be able to make some constraints and then you should of course use croup and imagegen to make sure the images are in the correct size when displayed on the webpage.
Yeah, thanks Jan, it makes a lot of sense. I wondered if there was anything that already does this, but I guess not. I would like to have a look at the new v6 API actually so maybe it's an excuse to do that :)
Constrain image upload dimensions and delete original
Hi,
I've maybe missed this somewhere, but I wondered if there's a way currently to save an instance of a dimensionally-constrained image upon saving to the media section, then deleting the original. In a practical example, what I'm trying to do is prevent clients uploading photos directly from their camera into the media section of their website at their original size. Ideally what I want to do is to constrain each image to a maximum of 800px in the maximum dimension, save this resized/constrained version (possibly optimise at this point too) then delete the original.
I know I could use imagegen or similar to resize images dynamically but I'd rather not be storing original large/high-res image that are never required at that resolution. I'd also like the customer not to have to worry about resizing manually before upload.
Any ideas appreciated. Thanks.
Hi Dan
I think you should use the API and hook in to the some of the events to do the resizing before the image is being saved so you don't risk having large images take up a lot of disk space.
So in C# you should be able to make some constraints and then you should of course use croup and imagegen to make sure the images are in the correct size when displayed on the webpage.
Does that make any sense?
/Jan
Yeah, thanks Jan, it makes a lot of sense. I wondered if there was anything that already does this, but I guess not. I would like to have a look at the new v6 API actually so maybe it's an excuse to do that :)
is working on a reply...