mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-25 19:00:03 +03:00
Support webp format (#1785)
* consider webP as an input and output format, meaning a derivative from webp is still a webp
This commit is contained in:
parent
7f3a1f417e
commit
79e91e3296
5 changed files with 10 additions and 3 deletions
|
@ -21,6 +21,7 @@ function guess_mime_type($ext)
|
||||||
case "jpg": $ctype="image/jpeg"; break;
|
case "jpg": $ctype="image/jpeg"; break;
|
||||||
case "png": $ctype="image/png"; break;
|
case "png": $ctype="image/png"; break;
|
||||||
case "gif": $ctype="image/gif"; break;
|
case "gif": $ctype="image/gif"; break;
|
||||||
|
case "webp": $ctype="image/webp"; break;
|
||||||
case "tiff":
|
case "tiff":
|
||||||
case "tif": $ctype="image/tiff"; break;
|
case "tif": $ctype="image/tiff"; break;
|
||||||
case "txt": $ctype="text/plain"; break;
|
case "txt": $ctype="text/plain"; break;
|
||||||
|
|
|
@ -221,6 +221,10 @@ SELECT
|
||||||
{
|
{
|
||||||
$file_path.= 'jpg';
|
$file_path.= 'jpg';
|
||||||
}
|
}
|
||||||
|
elseif (IMAGETYPE_WEBP == $type)
|
||||||
|
{
|
||||||
|
$file_path.= 'webp';
|
||||||
|
}
|
||||||
elseif (isset($conf['upload_form_all_types']) and $conf['upload_form_all_types'])
|
elseif (isset($conf['upload_form_all_types']) and $conf['upload_form_all_types'])
|
||||||
{
|
{
|
||||||
$original_extension = strtolower(get_extension($original_filename));
|
$original_extension = strtolower(get_extension($original_filename));
|
||||||
|
|
|
@ -47,6 +47,7 @@ class pwg_image
|
||||||
|
|
||||||
function __construct($source_filepath, $library=null)
|
function __construct($source_filepath, $library=null)
|
||||||
{
|
{
|
||||||
|
global $conf;
|
||||||
$this->source_filepath = $source_filepath;
|
$this->source_filepath = $source_filepath;
|
||||||
|
|
||||||
trigger_notify('load_image_library', array(&$this) );
|
trigger_notify('load_image_library', array(&$this) );
|
||||||
|
@ -58,7 +59,7 @@ class pwg_image
|
||||||
|
|
||||||
$extension = strtolower(get_extension($source_filepath));
|
$extension = strtolower(get_extension($source_filepath));
|
||||||
|
|
||||||
if (!in_array($extension, array('jpg', 'jpeg', 'png', 'gif')))
|
if (!in_array($extension, $conf['picture_ext']))
|
||||||
{
|
{
|
||||||
die('[Image] unsupported file extension');
|
die('[Image] unsupported file extension');
|
||||||
}
|
}
|
||||||
|
@ -810,4 +811,4 @@ class image_gd implements imageInterface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
1
i.php
1
i.php
|
@ -357,6 +357,7 @@ function send_derivative($expires)
|
||||||
case ".jpe": case ".jpeg": case ".jpg": $ctype="image/jpeg"; break;
|
case ".jpe": case ".jpeg": case ".jpg": $ctype="image/jpeg"; break;
|
||||||
case ".png": $ctype="image/png"; break;
|
case ".png": $ctype="image/png"; break;
|
||||||
case ".gif": $ctype="image/gif"; break;
|
case ".gif": $ctype="image/gif"; break;
|
||||||
|
case ".webp": $ctype="image/webp"; break;
|
||||||
}
|
}
|
||||||
header("Content-Type: $ctype");
|
header("Content-Type: $ctype");
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
// picture_ext : file extensions for picture file, must be a subset of
|
// picture_ext : file extensions for picture file, must be a subset of
|
||||||
// file_ext
|
// file_ext
|
||||||
$conf['picture_ext'] = array('jpg','jpeg','png','gif');
|
$conf['picture_ext'] = array('jpg','jpeg','png','gif','webp');
|
||||||
|
|
||||||
// file_ext : file extensions (case sensitive) authorized
|
// file_ext : file extensions (case sensitive) authorized
|
||||||
//
|
//
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue