How can I constraint an image to a maximum width and length?

5
When you have an image object, you can upload an image. Now I want to make sure that the image is not bigger than I.E. 500px * 250px. How can I make sure that a image that is bigger will not be allowed?
asked
2 answers
6

You can't enforce the user to select a image with a specified maximum resolution. The client isn't able to determine the resolution of the selected image. So the image always have to be uploaded to the server, and the server can determine the dimensions of the image (with JAVA). If the image is to big, you can send a warning with microflow. You can only constraint the image client-side on his size (MB, the property "max file size" in the property inspector of the image widget).

I don't know the context of your question. But you can also give a thumbnail size to the 'image uploader' widget (the width and height values separated by a ';'). In your example you can give the value "500;250". The server will store the original image and a thumbnail with the given dimensions. When you want to show the image with the 'image viewer' widget from the Form Editor, you can set the "show as thumbnail" property to true. Now the image viewer will show the 500 x 250 image.

answered
3

You can set height and width with the property menu in the modeler. If you click on the image, the properties height and width will appear in the properties bar and you can set your values. After that, the image can be viewed with the predefined height and width in the web browser. As far as I know, it isn't possible to set the maximum upload size of an image.

answered