ResponsiveFilemanager
ResponsiveFilemanager copied to clipboard
Image Damage with option image_max_width OR image_max_height
On Version 9.14.0, If the original image is to be reduced, then two defective images are created on the server. It worked with version 9.13.3
On Version 9.13.3 there is a same problem, when uploading a second image (larger as 2048px) with the same name.
$config['image_max_width'] = 2048; $config['image_max_height'] = 2048;
this problem is with php7.1 (php7.0 and 5.6 works properly), in UploadHandler.php $this->onUploadEnd function is run many times because condition
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) doesn't work,
so I added
if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
$targetPath = $this->options['storeFolder'];
$targetFile = $targetPath. $res['files'][0]->name;
if($size == null || $this->get_file_size($targetFile) == $size)
{
$this->onUploadEnd($res);
}
else
{
$this->head();
$this->body(json_encode($res));
}
}
does not work in portrait mode
The fix proposed by @mustangpl is not correct. The correct test for me is :
if(is_file($this->get_upload_path($name))){
- $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]);
- $totalSize = $this->get_file_size($this->get_upload_path($name));
- if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) {
+ $targetFile = $this->options['storeFolder'] . $res['files'][0]->name;
+ if($this->get_file_size($targetFile) == $size) {
$this->onUploadEnd($res);
}else{
$this->head();
The fix proposed by @mustangpl is not correct. The correct test for me is :
if(is_file($this->get_upload_path($name))){ - $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]); - $totalSize = $this->get_file_size($this->get_upload_path($name)); - if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) { + $targetFile = $this->options['storeFolder'] . $res['files'][0]->name; + if($this->get_file_size($targetFile) == $size) { $this->onUploadEnd($res); }else{ $this->head();
ahh @answeb man, you saved me. Thank you
The fix proposed by @mustangpl is not correct. The correct test for me is :
if(is_file($this->get_upload_path($name))){ - $uploaded_bytes = $this->fix_integer_overflow((int)$content_range[1]); - $totalSize = $this->get_file_size($this->get_upload_path($name)); - if ($totalSize - $uploaded_bytes - $this->options['readfile_chunk_size'] < 0) { + $targetFile = $this->options['storeFolder'] . $res['files'][0]->name; + if($this->get_file_size($targetFile) == $size) { $this->onUploadEnd($res); }else{ $this->head();
It works only in Landscape. In portrait mode the images are not converted and remain in original size. Anybody have an idea?