thaiphan/magento2-s3

Unable to upload image. Image not supported after installation

jobrandon opened this issue · 10 comments


untitled

Hi I got this error message when I try to upload a new image after the installation.

Hey @jobrandon,

What's the file extension of the file you're uploading? I think both Magento and AWS have restrictions on what can be uploaded but I can double check.

Regards,

Thai

smoi commented

I have the same problem after installing. I'm using a normal JPEG image which is working fine with standard filesystem.
I'm using Magento 2.2.5

Hi Thai (@thaiphan), i am getting the same issue while uploading product image and in console network, it shows

{error: "Unable to unserialize value, string is corrupted.", errorcode: 0}
error : "Unable to unserialize value, string is corrupted."
errorcode : 0

smoi commented

Same problem here.. @thaiphan do you think it's something related to Magento 2.2.5?

I am also getting the same error, Thai regarding "Unable to unserialize value" when uploading the images. My magento version is 2.2.4.

Please let me know the solution for this.

Thanks

SOLVED. I have found the issue. The issue is that when you leave 'Custom Headers' in backend blank, it will cause the issue with unserialize. So, if you don't want to set header than you can directly code inside Helper/Data.php and change line number #72 to this:-

return array();

Thai, can you please solve this issue permanently as this is temporary solution.

Thanks

@thaiphan the above fix from @ajayshukla return array(); is only the temporary fix and it directly stores the images on server but not on S3, can you please provide the proper fix for this to save images on S3.

smoi commented

Hello @thaiphan,

any news on this?

Thank you

@smoi i fixed this by making the meta empty, removed the headers and its working fine.

Thai\S3\Model\MediaStorage\File\Storage\S3
public function getMetadata()
{
$meta = [];
/$headers = $this->helper->getCustomHeaders();
if ($headers) {
$unserializedHeaders = $this->serializer->unserialize($headers);
foreach ($unserializedHeaders as $header) {
$meta[$header['header']] = $header['value'];
}
}
/
return $meta;
}

Hi @jobrandon, @smoi, @SarumugamLA, @ajayshukla

Sorry for taking so long to reply.

As described in #55, I've deployed a new version of the extension ( v1.3.2) that should resolve this issue. Can you advise if the fix works?

Also, I'm closing this issue as it's a duplicate of #50 and #55. Can you guys post to #50 if you need more assistance with this problem?

Regards,

Thai