preface
Problems caused by different path separators
$target_filename = str_replace('/.\/', '/', $target_filename);
$target_filename = str_replace('\\', '/', $target_filename);
define('PATH_PUBLIC', dirname(__DIR__, 3) . '/');
define('PATH_PUBLIC', str_replace('\\', '/', dirname(__DIR__, 3)) . '/');
Compatibility between Intervention Image and Windows
if (array_key_exists('exif', $this->options)) { $this->source_image_exif = null; try { $this->source_image_exif = \exif_read_data($this->downstream); } catch (Throwable $e) { } if (isset($this->source_image_exif)) { $this->source_image_exif['FileName'] = $this->source_filename; if (isset($this->source_image_exif['Orientation'])) { ImageManagerStatic::make($this->downstream)->orientate()->save(); } } if (!$ this->options['exif']) { unset($this->source_image_exif); if (ImageManagerStatic::getManager()->config['driver'] === 'imagick') { $img = ImageManagerStatic::make($this->downstream); $img->getCore()->stripImage(); $img->save(); } else { $img = @imagecreatefromjpeg($this->downstream); if ($img) { imagejpeg($img, $this->downstream, 90); imagedestroy($img); } else { throw new UploadException("GD: Unable to create a new JPEG without Exif data", 444); } } } }
if (array_key_exists('exif', $this->options)) { $this->source_image_exif = null; $tmp_name_img = $this->downstream . '.' . $ this->extension; try { $this->source_image_exif = \exif_read_data($this->downstream); } catch (Throwable $e) { } if (isset($this->source_image_exif)) { $this->source_image_exif['FileName'] = $this->source_filename; if (isset($this->source_image_exif['Orientation'])) { ImageManagerStatic::make($this->downstream)->orientate()->save($tmp_name_img); $renamed = rename($tmp_name_img, $this->downstream); } } if (!$ this->options['exif']) { unset($this->source_image_exif); if (ImageManagerStatic::getManager()->config['driver'] === 'imagick') { $img = ImageManagerStatic::make($this->downstream); $img->getCore()->stripImage(); $img->save($tmp_name_img); $renamed = rename($tmp_name_img, $this->downstream); } else { $img = @imagecreatefromjpeg($this->downstream); if ($img) { imagejpeg($img, $this->downstream, 90); imagedestroy($img); } else { throw new Exception("Unable to create a new JPEG without Exif data", 644); } } } }
public function __construct($source, $to, $destination, $quality=90) { if(! in_array($to, ['jpg', 'gif', 'png'])) { return $source; } $image = ImageManagerStatic::make($source); $image->encode($to, $quality)->save($destination); $this->out = $destination; }
public function __construct($source, $to, $destination, $quality=90) { if(! in_array($to, ['jpg', 'gif', 'png'])) { return $source; } $source_img = $destination . '.' . $ to; $image = ImageManagerStatic::make($source); $image->encode($to, $quality)->save($source_img); $renamed = rename($source_img, $destination); $this->out = $destination; }
There are too many redirections of links containing Chinese after the "SEO optimization of image/album URL address" function is enabled
$request_uri = server()['REQUEST_URI'] ?? '';
$request_uri = mb_convert_encoding(server()['REQUEST_URI'], "utf-8", "gbk") ?? '';
if (! starts_with($album['url'], get_current_url())) {
if (! starts_with(urldecode($album['url']), get_current_url())) {
if ($image['url_viewer'] != get_current_url(true, ['lang'])) {
if (urldecode($image['url_viewer']) != get_current_url(true, ['lang'])) {
Other issues