Not sure if i'm doing something wrong but the extension does not validate for images. It allows all other extensions resulting in errors below
Imagine\Exception\RuntimeException
Unable to open image /tmp/php7Bv8a7
↵
Caused by: Imagine\Exception\InvalidArgumentException
An image could not be created from the given input
Could i be doing this wrong. I tried it again with a new active record model with and without fileValidation and both allow all types of extensions (sql files archives etc )
<--model-->
public function behaviors()
{
$behaviors = parent::behaviors();
$behaviors[] = [
"class" => Illustrated::className(),
'attributes' => [
'avatar' => [
'aspectRatio' => 1,
'cropSize' => 200,
'tooSmallMsg'=> 'The Image uploaded "%s" is too small (%d×%d) to crop or scale to an appropriate picture.'
],
],
'directory' => '@images',
'baseUrl' => '@imagesurl',
'noImage'=>'Not a valid image',
'fileValidation'=>[
'extensions' => ['png', 'jpg', 'gif'],
'maxSize' => 1024*1024,
],
Not sure if i'm doing something wrong but the extension does not validate for images. It allows all other extensions resulting in errors below Imagine\Exception\RuntimeException
Unable to open image /tmp/php7Bv8a7 ↵ Caused by: Imagine\Exception\InvalidArgumentException
An image could not be created from the given input
Could i be doing this wrong. I tried it again with a new active record model with and without fileValidation and both allow all types of extensions (sql files archives etc )
<--model--> public function behaviors() { $behaviors = parent::behaviors(); $behaviors[] = [ "class" => Illustrated::className(), 'attributes' => [ 'avatar' => [ 'aspectRatio' => 1, 'cropSize' => 200, 'tooSmallMsg'=> 'The Image uploaded "%s" is too small (%d×%d) to crop or scale to an appropriate picture.' ],
], 'directory' => '@images', 'baseUrl' => '@imagesurl', 'noImage'=>'Not a valid image', 'fileValidation'=>[ 'extensions' => ['png', 'jpg', 'gif'], 'maxSize' => 1024*1024, ],
<--View-->
<?= $form->field($model, 'avatar')->widget(Uploader::className(), [ 'stylefileOptions' => [ 'btnClass' => 'btn btn-default', 'btnText' => 'Please, browse for image' ], 'cropperOptions' => [ 'diagonal' => 240, 'margin' => 5, 'sliderPosition' => 'right', 'sliderOptions' => [ 'animate' => 'slow' ] ], 'deleteOptions' => [ 'label' => '', // Font Awesome icon 'title' => 'Delete image' ], ],