Aggiunta restrizione nelle immagini supportate.
This commit is contained in:
Thomas Zilio 2020-05-04 09:45:48 +02:00
parent 0db3ef43cd
commit c83053b366
4 changed files with 10 additions and 1 deletions

View File

@ -33,6 +33,7 @@
"ext-simplexml": "*",
"ext-xsl": "*",
"ext-zip": "*",
"ext-fileinfo": "*",
"aluguest/ical-easy-reader": "^1.5",
"danielstjules/stringy": "^3.1",
"davidepastore/codice-fiscale": "^0.4.0",

View File

@ -17,7 +17,7 @@ $_SESSION['superselect']['id_categoria'] = $record['id_categoria'];
<div class="panel-body">
<div class="row">
<div class="col-md-3">
{[ "type": "image", "label": "<?php echo tr('Immagine'); ?>", "name": "immagine", "class": "img-thumbnail", "value": "<?php echo $articolo->image; ?>" ]}
{[ "type": "image", "label": "<?php echo tr('Immagine'); ?>", "name": "immagine", "class": "img-thumbnail", "value": "<?php echo $articolo->image; ?>", "accept": "image/x-png,image/gif,image/jpeg" ]}
</div>
<div class="col-md-9">

View File

@ -241,6 +241,10 @@ class Upload extends Model
$filepath = $upload->filepath;
if (!in_array(mime_content_type($filepath), ['image/x-png', 'image/gif', 'image/jpeg'])) {
return;
}
$driver = extension_loaded('gd') ? 'gd' : 'imagick';
ImageManagerStatic::configure(['driver' => $driver]);

View File

@ -406,6 +406,10 @@ class Uploads
$fileinfo = self::fileInfo($filepath);
$directory = empty($directory) ? dirname($filepath) : $directory;
if (!in_array(mime_content_type($filepath), ['image/x-png', 'image/gif', 'image/jpeg'])) {
return;
}
$driver = extension_loaded('gd') ? 'gd' : 'imagick';
Intervention\Image\ImageManagerStatic::configure(['driver' => $driver]);