I have two questions...
1) Is there anything in the Chronoforms component that automatically validates the dimensions of an image when uploaded? I see that there is something for file size and type. If not, can I use PHP to do so? I've seen scripts out there that do similar things, like this:
2) I see that there's an image resizer. If I leave the height, for instance, blank, will it resize proportionally based off only the width?
The reason I ask these things is that I have clients that will be uploading images of different dimensions, but I want to either validate that their width is to large, or automatically resize the images based on only the width.
1) Is there anything in the Chronoforms component that automatically validates the dimensions of an image when uploaded? I see that there is something for file size and type. If not, can I use PHP to do so? I've seen scripts out there that do similar things, like this:
<?php
$source_image = $_POST('upload_image'); //retrieve image value from form
$w = 410;
$h = 216;
//capture dimension of the uploaded image
list($width, $height) = getimagesize($source_image);
//verification of dimensions
if ( ($width != $w) && ($height != $h)){
return false; //triggers error
}
else
return true;
?>
2) I see that there's an image resizer. If I leave the height, for instance, blank, will it resize proportionally based off only the width?
The reason I ask these things is that I have clients that will be uploading images of different dimensions, but I want to either validate that their width is to large, or automatically resize the images based on only the width.
Hi ahwoogamac,
1) There's nothing built into ChronoForms that will validate image sizes. It's possible that you could add this in the server-side validation.
2) The image resizer will do what you want I think. From memory it will keep the proportions and re-size to the max allowed in the settings. There's also a crop option, not sure how that works.
Note that the image re-sizer will only re-size one file upload per form.
Bob
1) There's nothing built into ChronoForms that will validate image sizes. It's possible that you could add this in the server-side validation.
2) The image resizer will do what you want I think. From memory it will keep the proportions and re-size to the max allowed in the settings. There's also a crop option, not sure how that works.
Note that the image re-sizer will only re-size one file upload per form.
Bob
Thanks! I'll test that out.
This topic is locked and no more replies can be posted.