Skip to content

Commit

Permalink
Merge pull request #50 from nguyenanhung/v3.2.0-develop
Browse files Browse the repository at this point in the history
Add mimes
  • Loading branch information
nguyenanhung authored Apr 28, 2024
2 parents ed8fb37 + ce99c4a commit af1ed64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions config/mimes.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@
'tif' => 'image/tiff',
'heic' => 'image/heic',
'heif' => 'image/heif',
'avif' => 'image/avif',
'webp' => 'image/webp',
'css' => array('text/css', 'text/plain'),
'html' => array('text/html', 'text/plain'),
'htm' => array('text/html', 'text/plain'),
Expand Down
22 changes: 13 additions & 9 deletions system/language/english/imglib_lang.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* CodeIgniter
*
Expand Down Expand Up @@ -26,17 +27,17 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
* @copyright Copyright (c) 2014 - 2019, British Columbia Institute of Technology (https://bcit.ca/)
* @copyright Copyright (c) 2019 - 2022, CodeIgniter Foundation (https://codeigniter.com/)
* @license https://opensource.org/licenses/MIT MIT License
* @link https://codeigniter.com
* @since Version 1.0.0
* @filesource
*/
defined('BASEPATH') OR exit('No direct script access allowed');
defined('BASEPATH') or exit('No direct script access allowed');

$lang['imglib_source_image_required'] = 'You must specify a source image in your preferences.';
$lang['imglib_gd_required'] = 'The GD image library is required for this feature.';
Expand All @@ -45,6 +46,9 @@
$lang['imglib_gif_not_supported'] = 'GIF images are often not supported due to licensing restrictions. You may have to use JPG or PNG images instead.';
$lang['imglib_jpg_not_supported'] = 'JPG images are not supported.';
$lang['imglib_png_not_supported'] = 'PNG images are not supported.';
$lang['imglib_webp_not_supported'] = 'WEBP images are not supported.';
$lang['imglib_avif_not_supported'] = 'AVIF images are not supported.';
$lang['imglib_webp_not_supported'] = 'WEBP images are not supported.';
$lang['imglib_jpg_or_png_required'] = 'The image resize protocol specified in your preferences only works with JPEG or PNG image types.';
$lang['imglib_copy_error'] = 'An error was encountered while attempting to replace the file. Please make sure your file directory is writable.';
$lang['imglib_rotate_unsupported'] = 'Image rotation does not appear to be supported by your server.';
Expand Down
4 changes: 2 additions & 2 deletions system/libraries/Image_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ public function initialize($props = array())
else
{
// Is there a file name?
if ( ! preg_match('#\.(jpg|jpeg|gif|png)$#i', $this->new_image))
if ( ! preg_match('#\.(jpg|jpeg|gif|png|webp|avif)$#i', $this->new_image))
{
$this->dest_image = $this->source_image;
$this->dest_folder = $this->new_image;
Expand Down Expand Up @@ -1237,7 +1237,7 @@ public function overlay_watermark()
imagecopymerge($src_img, $wm_img, $x_axis, $y_axis, 0, 0, $wm_width, $wm_height, $this->wm_opacity);
}

// We can preserve transparency for PNG images
// We can preserve transparency for PNG, WEBP, AVIF images
if ($this->image_type === 3)
{
imagealphablending($src_img, FALSE);
Expand Down

0 comments on commit af1ed64

Please sign in to comment.