Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>In short :</strong> your first option is the best</p> <p><strong>Long version:</strong> I'm not sure you can use base64 urls to post on facebook - for the same reasons that you can't use a GET request for huge base64 strings (do they support urls that are that long ?) - so you might actually <em>need</em> to save these pictures. </p> <p>I'm not sure, but i think only pictures that are directly posted by the user (not <em>linked to</em> by a "share" button) are saved facebook-side, the other ones are actually sitting in your server.</p> <p>First of all then, you should test if sending huge base64 strings directly through facebook API works - i tried creating a graph api meta tag for a small image using FB's online tool and it didn't work, so this doesn't look good (though i admit i don't know FB API well).</p> <p>Let's admit you'll have to save this image for good - sending it to your server through an AJAX POST request is not that hard. If you use <a href="http://api.jquery.com/jQuery.post/" rel="nofollow">JQuery</a> it's even really simple. Just use ruby to convert the base64 to an image file afterwards.</p> <p><strong>EDIT:</strong> I just wonder if i undestand well the question. Do you just want your users to be able to download the created image ? if so, they just have to right-click>save the generated image. The <a href="http://www.nihilogic.dk/labs/canvas2image/" rel="nofollow">canvas2image lib</a> can even make this easier for "right-click impaired" users ;)</p> <p><strong>EDIT 2:</strong> Here's an example of an ajax POST request with JQuery :</p> <pre><code>$.post( // first argument : the URL you want to POST to 'url/to/post.js', // second argument: the data to send to the server myData, // third argument : a callback function, // that is called when the request is complete // and is passed the data returned by the server // + response status (success, error...) function( data ){ alert('request completed, returned :' + data); }); </code></pre> <p>so in your case, you could do something like this:</p> <pre><code>$.post( '&lt;%= create_facebook_image_path format: :js %&gt;', { base_64_string: img }, function( data ){ $('#viewport').append( $('&lt;img /&gt;').attr({ src: data.url }) ); }); </code></pre> <p>more examples are available in <a href="http://api.jquery.com/jQuery.post/" rel="nofollow">JQuery's doc</a>, including how to handle success / error status. I advise you to learn using JQuery, you will soon find how it is simple yet powerful !</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload