Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pasting images from clipboard in Firefox suddenly enabled (tinymce)

I'm using TinyMCE for richtext editing in a webmail client. Suddenly, after years and years of begging us to build something like this, customers are able to paste images directly from the clipboard in tiny. While I always try to achieve to be as smart as Google, I immediately logged in to my Gmail account and started pasting away.. Yep, paste also worked in Gmail and, yep, images were also broken in the sent e-mail.

Here is a shortened part of the html, as generated by firefox after pasting my screenshot into the textarea:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABDgAAA<andsoonfor100k>"/>

I have to say, I'm very excited about this new feature, but I cannot seem to find anything (literally!) about this topic, so any suggestions about when this was added to firefox, or even how to make this actually work in e-mail clients will be really appreciated!

like image 272
Robbert van den Bogerd Avatar asked Jun 05 '12 12:06

Robbert van den Bogerd


1 Answers

This is a bit old, but this was added to Firefox since version 4, and Thunderbird (sort-of) since version 6 (it seems it could read them since version 3).

In the case of Thunderbird, even if Thunderbird support Data URIs, other email clients may not, so Thunderbird convert them to classic MIME attachments (with CIDs as URL).

In the case of GMail, as of today (march 2013), pasted image data is included as data URIs, while drag-and-droped images (at least in Linux, with Gnome, from Nautilus to Firefox) include them as common MIME attachments. So, if you send an email with a data URI image, some email clients will display it correctly, some will not. (Ironic thing, Gmail cannot display them, at least not with Firefox and Chrome).

BTW, in Thunderbird at least, as the data URI don't have full information about the image, if you try to save it you need to provide the name or use the "image.jpeg" generic name.

Information about Data URIs:

  • https://www.rfc-editor.org/rfc/rfc2397
  • http://en.wikipedia.org/wiki/Data_URI_scheme

Information about how to remove or convert Data URIs from pasted data in CKEditor (some people don't like them for some [valid] reasons):

  • http://ckeditor.com/forums/Plugins/ImagePaste-plugin-for-Firefox
  • http://dev.ckeditor.com/ticket/8208

So, there is much information, maybe just searching for "data uri" would return more results.

like image 54
MV. Avatar answered Nov 15 '22 08:11

MV.