cardkit icon indicating copy to clipboard operation
cardkit copied to clipboard

"download ... failed - Network error" on scaled images.

Open stucka opened this issue 9 years ago • 3 comments

We've got 1.1.0 running, and everything had been fine. On May 17, I tweaked the themes JSON just to reorder the entries. The file still validates. The server hasn't changed.

Now we're starting to get problems, at least mostly in Chrome, though a coworker says in Firefox. My Chrome was acting up. I get a message in the download bar: download Failed - Network error

This is happening on my default image, which is for Facebook at 600x315 at 2x or 3x scale. It also seems to be happening on other photo sizes at 2x or 3x. My temporary fix was to build a default at 1200x630 1x, which works just fine.

I get no console errors. Chrome developer tools show three files moving: JPG, PNG, SVG + xml ... And I get the same sorta three files for actual downloads and that "Failed - Network error."

Any ideas?

stucka avatar Jun 06 '16 18:06 stucka

Hey @stucka,

This is interesting, I've noticed the same issue on one of our builds lately, but it's only happens occasionally and I haven't been able to get to the bottom of it yet.

Any chance you can provide details of your card config? Specifically do you have image components, are they editable / uploadable, and if so, how many are there?

I think it could be something to do with the size of the file that is produced by the SVGtoPNG process, but this is just a guess, I'd like to do more research 💭 ! Your notes are very helpful 👍

chrishutchinson avatar Jun 07 '16 08:06 chrishutchinson

So - I haven't been able to test it in CardKit yet, but I've been doing some work on another project that was facing similar issues.

I think it may be due to the size of the data generated from the SVG > Canvas process. Converting this using (canvas.toDataURL('image/png')) is likely the issue. I've been able to change it to use canvas.toDataURL('image/jpg') in another project of mine and that has helped alleviate the issue.

The change would be made in CardKit here: https://github.com/times/cardkit/blob/423ba8fe5114ced961bad9f78e1bb03ffc1c0dbc/bower_components/saveSvgAsPng/saveSvgAsPng.js#L112

If you want to test it please try, I'll try and do the same when I get a chance - hopefully in the next day or two!

chrishutchinson avatar Jun 17 '16 15:06 chrishutchinson

My cardkit build was ... actually a compiled version I took from somewhere else, I think, then with me mangling some of the json and js directly. I tried to get the cardkit git up and running but kept running into some weird bower conflicts on Windows and walked away. Probably shoulda tried under the Xubuntu VM, but I was just trying to get something working quickly and get going.

About the same time cardkit started acting up we started having intermittent problems with an image resizer, which is basically the old Vox meme generator with nearly all the functionality stripped out. cardkit of course has a common lineage there; my guess'd be something changed in how Chrome handles a piece of the Vox code that cardkit is still using.

And maybe now that I've sucked up some of your time, I probably ought to try again in both Windows and Xubuntu to get bower going again and/or to file another issue.

stucka avatar Jun 17 '16 15:06 stucka