Skip to content
Permalink
Browse files

Adjust how we are resolving our convert_image function bug, we will r…

…esolve fully in v10 and do simpler change in v10
  • Loading branch information...
chrisgraham committed Jul 24, 2019
1 parent da37ff6 commit 4693d778eb0cb41beb89d483b566d6aa4f8fc7fb
Showing with 7 additions and 5 deletions.
  1. +1 −1 data_custom/functions.dat
  2. +3 −1 sources/images.php
  3. +3 −3 sources/images2.php

Large diffs are not rendered by default.

@@ -551,8 +551,10 @@ function ensure_thumbnail($full_url, $thumb_url, $thumb_dir, $table, $id, $thumb
* @param ?array $thumb_options This optional parameter allows us to specify cropping or padding for the image. See comments in the function. (null: no details passed)
* @return boolean Success
*/
function convert_image($from, &$to, $width, $height, $box_width = -1, $exit_on_error = true, $ext2 = null, $using_path = false, $only_make_smaller = true, $thumb_options = null)
function convert_image($from, $to, $width, $height, $box_width = -1, $exit_on_error = true, $ext2 = null, $using_path = false, $only_make_smaller = true, $thumb_options = null)
{
// TODO: Make sure in v11 $to is returned by reference, as it may get changed if the output file type has to be changed for feature-preservation
require_code('images2');
cms_profile_start_for('convert_image');
$ret = _convert_image($from, $to, $width, $height, $box_width, $exit_on_error, $ext2, $using_path, $only_make_smaller, $thumb_options);
@@ -102,7 +102,7 @@ function _ensure_thumbnail($full_url, $thumb_url, $thumb_dir, $table, $id, $thum
*
* @ignore
*/
function _convert_image($from, &$to, $width, $height, $box_width = -1, $exit_on_error = true, $ext2 = null, $using_path = false, $only_make_smaller = false, $thumb_options = null)
function _convert_image($from, $to, $width, $height, $box_width = -1, $exit_on_error = true, $ext2 = null, $using_path = false, $only_make_smaller = false, $thumb_options = null)
{
disable_php_memory_limit();
@@ -499,13 +499,13 @@ function _convert_image($from, &$to, $width, $height, $box_width = -1, $exit_on_
}
if ($ext2 == 'png') {
if (strtolower(substr($to, -4)) != '.png') {
if ((strtolower(substr($to, -4)) != '.png') && (get_file_extension($to) != '')) {
$to .= '.png';
}
}
$lossy = ($width <= 300 && $width != -1 || $height <= 300 && $height != -1 || $box_width <= 300 && $box_width != -1);
$unknown_format = false;
$test = cms_imagesave($dest, $to, $ext2, $lossy, $unknown_format);

0 comments on commit 4693d77

Please sign in to comment.
You can’t perform that action at this time.