Error :- "...../image.jpg" is not a valid image file type

Solved
kumar10
Tourist
11 0 1

I am trying to create new image for my product using 'Shopify rest Admin API' 

method :-  POST

API End point : -  ' /admin/api/2020-07/products/{My_product_id}/images.json'

Payload :- 

{

"image": {
      }
}
 
Response : - 
Status:  422 Unprocessable Entity
{
     "errors": {
     "image": [
            "/5f218572b0242e75f1a8c521/US-Ku-1000/11224.jpg is not a valid image file type."
       ]
   }
}

 

0 Likes
Jason
Shopify Expert
10407 164 2050

It's not an image. If you look at the content type for that file it's an application/octet-stream. Try adjusting the content type for that file in your bucket and try again.

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
0 Likes
kumar10
Tourist
11 0 1

Hi @Jason

I convert the image into base64 but, still getting error. 

payload:-   
{
"image" :{
 "attachment":data : image/jpeg;base64,/9j/2wCEAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRQBAwQEBQQFCQUFCRQNCw0UFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFP/AABEIBTMH0AMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5..........Continues like this",
 "filename":"myFile.jpeg"
}
}
 
 
Response : - 
Status:  422 Unprocessable Entity

{

     "errors": {
          "image": [
                    "The uploaded image is corrupt and cannot be processed. Please try a different image."
           ]
      }
}

 

0 Likes

Try with another image you are sure it is fine.

https://apps.shopify.com/picamaze
Animated watermarks for product images and ads
0 Likes
Jason
Shopify Expert
10407 164 2050

This is an accepted solution.

You're getting a different error now so it's a different problem.

Why are you adding this into the attachment data? 

 

 

data : image/jpeg;base64

 

 

Did you pull that format from the docs or simply copy and paste the contents from a conversion tool?

I jump on these forums to help and share some insights. Not looking to be hired, and not looking for work.

Don't hand out staff invites or give admin password to forum members unless absolutely needed. In most cases the help you need can be handled without that.


★ http://freakdesign.com.au ★
jbwieg09
New Member
1 0 0

I ran into this problem and wanted to post my solution in case it could help the next person.

I was bringing the image over from ClickUp.  The standard url forces the image to download, which I saw in another post is a problem for shopify.  Use url_w_query where ?view=open is on the end of it.  Did the trick.

If you're bringing it from somewhere else and it will only download in browser, I must say I don't envy you after all the rabbitholes I was goin' down lookin' for answers here lol good luck!

0 Likes