Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Can't render base 64 encoded PNG

Name: Anonymous 2011-06-25 10:57

Is anyone else unable to render this?

http://pastebin.com/LEGQqFXi

Specifically what's going on is I've got an HTML5 Canvas. I .toDataURI it and send that off to PHP with AJAX. PHP stores that in a database.

Then I have a different page that has an <img> element to request that data from the database and render it. But it... won't. The data's getting through, I can see it with the browser's view source function:

<img id="embedded" src="data:image/png;base64,iVBORw...5CYII=" />

(ellipsis added)

It's not being truncated or anything stupid like that, I have document.write's and echo's in every script from where the data is generated by the canvas to where it's embedded into the final <img> element, and it's getting through completely intact.

I've tried it with image URIs generated by other sources and there's no problem. I've tested this in Chrome 12 and Firefox 5, behavior was identical in both.

A final oddity is that when the canvas is totally blank, the image data it generates IS displayed: I get a blank image with the same dimensions as the original canvas. But as soon as I draw anything on it, nothing. Just the familiar little error-loading-image icon.

This is my code for the receiving end:

<html>
<head>
</head>

<body>
<img id="embedded" src="<?php include("receiver.php"); ?>" />
</body>

</html>

And for the sending end:

http://pastebin.com/hwsEfsaD

Name: Anonymous 2011-06-25 11:09

what the fuck is this

Name: Anonymous 2011-06-25 12:08

RENDER MY ANUS!

Name: Anonymous 2011-06-25 20:32

HTML5 Canvas
// code for IE6, IE5
What the fuck.

Look at the image data itself.

Name: Anonymous 2011-06-25 22:02

>>4
haha I didn't notice that. This is my first AJAX project, that part of the code was copy pasted.

anyway turns out the data had to be URI encoded before going off to the server with POST. Didn't know that. Do now. All is well.

Name: Anonymous 2011-06-26 5:21

that part of the code was copy pasted
That's going to end well.

Don't change these.
Name: Email:
Entire Thread Thread List