thaiphan / magento2-s3

Use Amazon S3 as the file storage solution for your Magento 2 application
MIT License
142 stars 95 forks source link

Unable to upload image. Image not supported after installation #51

Closed jobrandon closed 6 years ago

jobrandon commented 6 years ago

untitled

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

thaiphan commented 6 years ago

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 6 years ago

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

SarumugamLA commented 6 years ago

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 6 years ago

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

ajayshukla commented 6 years ago

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

ajayshukla commented 6 years ago

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

SarumugamLA commented 6 years ago

@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 6 years ago

Hello @thaiphan,

any news on this?

Thank you

SarumugamLA commented 6 years ago

@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; }

thaiphan commented 6 years ago

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