Responsive File Manage

imagecreatetruecolor imagefilledrectangle required int and not float
UTF8_encode
This commit is contained in:
Fred Tempez 2023-02-10 11:25:05 +01:00
parent bc43689d41
commit c48da3d7f9
3 changed files with 8 additions and 6 deletions

View File

@ -14,6 +14,7 @@ class UploadHandler
{
protected $options;
protected $response;
// PHP File Upload error message codes:
// http://php.net/manual/en/features.file-upload.errors.php

View File

@ -353,8 +353,8 @@ class imageLib {
// *** Get optimal width and height - based on $option
$dimensionsArray = $this->getDimensions($newWidth, $newHeight, $option);
$optimalWidth = $dimensionsArray['optimalWidth'];
$optimalHeight = $dimensionsArray['optimalHeight'];
$optimalWidth = (int) $dimensionsArray['optimalWidth'];
$optimalHeight = (int) $dimensionsArray['optimalHeight'];
// *** Resample - create image canvas of x, y size
$this->imageResized = imagecreatetruecolor($optimalWidth, $optimalHeight);
@ -463,7 +463,7 @@ class imageLib {
else
{
$color = imagecolorallocate($im, $this->fillColorArray['r'], $this->fillColorArray['g'], $this->fillColorArray['b']);
imagefilledrectangle($im, 0, 0, $width, $height, $color);
imagefilledrectangle($im, 0, 0, (int)$width, (int)$height, $color);
}
}
@ -483,8 +483,8 @@ class imageLib {
// *** Get cropping co-ordinates
$cropArray = $this->getCropPlacing($optimalWidth, $optimalHeight, $newWidth, $newHeight, $cropPos);
$cropStartX = $cropArray['x'];
$cropStartY = $cropArray['y'];
$cropStartX = (int)$cropArray['x'];
$cropStartY = (int)$cropArray['y'];
// *** Crop this bad boy
$crop = imagecreatetruecolor($newWidth, $newHeight);

View File

@ -735,8 +735,9 @@ function fix_filename($str, $config, $is_folder = false)
}
if ($config['transliteration']) {
// Le site est en UTF8
if (!mb_detect_encoding($str, 'UTF-8', true)) {
$str = utf8_encode($str);
$str = mb_convert_encoding($str, 'UTF-8', mb_list_encodings());
}
if (function_exists('transliterator_transliterate')) {
$str = transliterator_transliterate('Any-Latin; Latin-ASCII', $str);