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

Input.uploadedImage

Input.uploadedImage($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 with the following extensions are allowed: jpg jpeg png gif webp

Otherwise, this method behaves like uploadedFile.

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

Input.uploadedImage('screenshotImage', dir'screenshots', '800x600')
//= Ex: 'screenshots/t9g2tnvpq2p7umy73.jpg'

Options

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

See Also