/cart/add.js no longer supports image blobs in the cart properties

/cart/add.js no longer supports image blobs in the cart properties

Jamie_Funnell
Tourist
5 0 3

Hello

 

It seems recently shopify has either changed something here, or a bug...

 

Either way, customers who have to upload custom images to our site for us to print, is now useless as the image is not coming through. https://gyazo.com/c56c8c0c2e5c310ea6f6ca914fb93192 This is currently how it looks compared to it coming through as a picture before.

 

Any help, this is a big issue for my store.

Replies 7 (7)

Small_Task_Help
Shopify Partner
830 27 75

Hi

 

Hope this will help

 

Convert uploaded images to Base64 strings and ensure they are correctly included in your AJAX requests to /cart/add.js

 

convert an image to Base64 using JavaScript example

function getBase64Image(img) {
    var canvas = document.createElement("canvas");
    canvas.width = img.width;
    canvas.height = img.height;
    var ctx = canvas.getContext("2d");
    ctx.drawImage(img, 0, 0);
    var dataURL = canvas.toDataURL("image/png");
    return dataURL;
}

 

To Get Shopify Experts Help, E-mail - hi@ecommercesmalltask.com
About Us - We are Shopify Expert Agency
At Google My Business - Ecommerce Small Task - Hire Shopify Developers Ahmedabad
Jamie_Funnell
Tourist
5 0 3

Sadly that makes the cart field have 1000 letters for  text in at checkout.

 

 
That isnt a viable option... It looks awful.
 

Matth9152
Shopify Partner
9 1 3

Just jumping into this thread to report the same issue.

 

We have been submitting image blobs to the cart via the API for some time now, and this ability seems to have been removed overnight and is now instead submitting an object, e.g.:

{"filename"=>"img.png", "type"=>"image/png", "name"=>"properties[Please upload image you would like us to use.]", "tempfile"=>"#<File:0x00007a7646039788>", "head"=>"Content-Disposition: form-data; name="properties[Please upload image you would like us to use.]"; filename="img.png"\r\nContent-Type: image/png\r\n"}



Kunth
Shopify Partner
2 0 0

We have the same issue, but we don't use API
We have been using HTML <input/> tag:

<input id="prescription_img" type="file" name="properties[prescription_img]" accept=".jpg, .jpeg, .png, .webp, .pdf">

Kunth_1-1728037219445.png

It worked correctly before
We had not changed anything

 

Jamie_Funnell
Tourist
5 0 3

Sadly they dont seem to be aware of this, I have been to live chat and they said they have passed it on, but its still not working.

Matth9152
Shopify Partner
9 1 3

I've had a reasonably extensive chat with support today, and they have said that their developers are now actively looking into it and plan to implement a fix. Hopefully, this should be resolved soon.

Matth9152
Shopify Partner
9 1 3

Just had a follow up email from support, and it looks like this should now be resolved.