Closed akwatra closed 6 years ago
I don't understand your pull request. Can you copy here the logs produced by the class, which show the problem? (so before your patch)
To reproduce error at your end: upload png image $handle->image_convert = 'jpg';
and do resize: $handle->image_background_color = '#FFFFFF'; $handle->image_ratio_fill = true; $handle->image_resize = true; $handle->image_x = 300; $handle->image_y = 230; $handle->process($current_img_dir);
Image extension should be ".jpg" but it was creating png as this was taking
$this->file_dst_pathname but this should take new file ext while creating jpg image in
look into LINE 4795
switch($this->image_convert) {
case 'jpeg':
case 'jpg':
if (!$return_mode) {
$result = @imagejpeg($image_dst, $this->file_dst_path . '/' . $this->file_dst_name_body .'.jpg', $this->jpeg_quality);
in log also taking the wrong extension, in this patch log also has to correct yet.
######## LOG ######### system information
I see. In fact, you are in an edge case, with _file_src_nameext which is empty. You are trying to convert a local file, which is an image, but there is no file extension. And in the code, there is:
if ($this->file_src_name_ext) $this->file_dst_name_ext = $this->image_convert;
$this->log .= '- new file name ext : ' . $this->image_convert . '<br />';
It was by design, to not add an extension is there is no extension to start with, but it didn't deal with the case of converting an image with no extension.
I have applied the proper correction here d3e1301
Thank you for spotting the issue.
Hi Verot, I have tested with browser proper via form upload and that file had extension png, so after image created, it keeps the png ext as a bug and did not rename to jpg.
issue came, when i was trying to open that image and that was not showing data in viewer, then I dig into and found the bug. You please double check once at your end with png an extention image.
I did try with PNG, and it converted to JPEG, with a .jpg extension:
system information
Try with the new master, it should work for you too.
It's Working Now! Thx.
when you used $handle->image_convert = 'jpg'; and $handle->image_resize = true; it was taking old file extension name as destination and image type data was resultant corrept image.