Resize an image on the Server size before upload
Hi
I am using the following line of code to transform a image before uploading it,
ransformation = new Transformation().Quality(DefaultQualityTransformation)
Where: DefaultQualityTransformation = "auto:eco"
The issue is if the file limit is 10mb, and the file is 10.1. The image does not get transformed. But say if it was 9.9mb the size of the file would drastically be reduced.
Is there a way to reduce the file size before uploading?
Thanks
-
Hi
Any resizing of the image that is done before the upload, cannot be done by Cloudinary.
What comes close to what you want to achieve is our incoming transformations which allow performing the transformation upon uploading itself.
Hope that helps.
-
This is what i am doing
var uploadParams = new ImageUploadParams
{
UseFilename = true,
UniqueFilename = false,
Folder = "test" + " / ",
PublicId = Guid.NewGuid().ToString(),
EagerTransforms = new List<Transformation>()
{
new Transformation().Quality("auto:eco")
},
File = new FileDescription(@"C:\blah\_DSC0093.JPG")
};var uploadResult = _cloudinaryClient.Value.Upload(uploadParams);
-
Hi
The error you share indeed show that the image size is above the maximum allowed for upload for the account.
Eager transformations are transformations that are performed after the upload is occurring. Incoming transformations are transformations that happen upon uploading, so the image with the transformation will be considered as an original in the account.
Note that both these approaches don't resize the image before the upload. Any change to the image before the upload needs to be performed by an external way.
does that make sense?
Post is closed for comments.
Comments
4 comments