Version: v0.7.0 - Beta.  We welcome contributors & feedback.

Input.getUploadedImage

Input.getUploadedImage($fieldName, $uploadDir, $size='500x500', $options={}) -> string

Description

Returns the uploaded image file path for the given $fieldName.

The file will be resized to within given $size while keeping the same aspect ratio as the original.

Only files that are jpg, jpeg, png, or gif are allowed.

Otherwise, this method behaves like getUploadedFile.

// HTML tag:
// <input type="file" name="screenshotImage">

Input.getUploadedImage('screenshotImage', 'screenshots', '800x600')
//= e.g. 'screenshots/t9g2tnvpq2p7umy73.jpg'

Options

Option Value Description
exactSize true/false Resize to the given size, cropping to the center if necessary.
Input.getUploadedImage('profileImage', 'profiles', '600x600', { exactSize })

See Also