How do I include base64 image in tinymce - tinymce

I'm having a problem including a base64 image using tinymce.activeEditor.execCommand('mceInsertContent',
The following works:
tinymce.activeEditor.execCommand("mceInsertContent", true, "<img style = 'height:80px;width:80px' src='/Content/image.png' />");`
tinymce.activeEditor.execCommand("mceInsertContent", true, "<div>safasfdasfd</div>");
But when using tinymce.activeEditor.execCommand('mceInsertContent', true, img64);
where img64 is a base64 image received from a MVC partial view converted to string.
Does someone have a working example. I don't know if the syntax is wrong or if there is some option I have forgotten?
Update:
The following do not work:
tinymce.activeEditor.execCommand("mceInsertContent", true, "<img style='height:80px;width:80px' src='data:image/png;base64,/some long 64 string is here'>");
Does anyone know why this is not working? Some help would be greatly appreciated.

It seems that others are having this problem as well. Until there is an official way to solve your problem, there is a workaround posted in this thread: https://github.com/buddyexpress/bdesk_photo/issues/2
UPDATE: Solution is to add paste_data_images : true to your configuration.
See the docs here: http://www.tinymce.com/wiki.php/Configuration:paste_data_images

Try mceInsertRawHTML rather than mceInsertContent

Related

Sammyk/LaravelFacebookSdk - Never returns user profile picture. always return this url: "https://lookaside.facebook.com/etc"

I know this type of question has been asked many times. but honestly, NOT A SINGLE one solved my problem.
here is what im coding:
$resPicture = $FB->get('/me?fields=picture', $token);
$resBody = $resPicture->getGraphUser();
$resBody = $resBody["picture"];
echo '<img src="'.$resBody["url"].'">';
dd();
and the img src is: https://lookaside.facebook.com/platform/profilepic/?asid=114975966053890&height=50&width=50&ext=1527323170&hash=AeR3847SlhI8RuNC
Tried every possible thing but nothing useful.
tell me where im making mistake, any help would be great.
Thanks.

How to make restsharp to work with the right encoding for response?

I have the same problem like this question
RestSharp ignores response charset encoding.
But there is no right answer!
Code like this
IRestResponse RSP = client.Execute(request);
not like this
Encoding encoding = Encoding.GetEncoding("ISO-8859-1");
var result = encoding.GetString(response.RawBytes);
It means the resetsharp must deserializ the result with right encoding.
Someone can help?
I solved this problem by myshelf
you just down the code source from github and edit the code
stemp 1: find HttpResponse.cs :
stemp 2: find Http.cs ,
Ohm,maybe this solution is not match you,my request result like this,just edit the code like what I do ,then it will work well
[enter image description here][3]

FileChooserButton Gtk

Can someone tell me what type of signal for FileChooserButton I have to use, to get file path by clicking on the actual file in FileChooserDialog that was brought up by FileChooserButton? I've used both file_set and file_activated signals but nothing has happened.
I've used an example from Vala language documentation. And I'm not sure whether there should be Open\Cancel buttons in that dialog(See the screenshot below)?
Here is the code, that I've used:
Gtk.FileChooserButton file_chooser = new Gtk.FileChooserButton(
"Select a file",
Gtk.FileChooserAction.OPEN);
file_chooser.set_show_hidden(true);
file_chooser.set_local_only(false);
file_chooser.set_current_folder("/home");
Gtk.FileFilter filter = new Gtk.FileFilter();
filter.add_mime_type("application/x-shellscript");
file_chooser.set_filter(filter);
file_chooser.file_set.connect(() => {
string uri = file_chooser.get_uri();
stdout.printf("Uri: %s", uri);
});
Screenshot
Thanks in advance!
Solved it! The problem was in missing buttons Ok\Cancel, this occurs only in Elementary OS, I believe.
Command:
gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/DialogsUseHeader':<0>}" did it's job!
Thanks for the replies.

phonegap-base64 plugin - how to use at the ionic framework

I added the plugin by using the link at cli.
Plugin: phonegap local plugin add org.apache.cordova.device
Plugin-Link: https://github.com/hazemhagrass/phonegap-base64
Now I did copy the code in my controller, but it does not work.
Code:
//filePath is the absolute path to the file(/mnt/sdcard/...)
window.plugins.Base64.encodeFile(filePath, function(base64){
console.log('file base64 encoding: ' + base64);
});
My question is, how do I activate the plugin? Like using for example "$cordovaCamera". Maybe somebody can show me a correct controller example. Thanks for your help.
Christoph, The base64 converting is very simple with this plugin , we just need to call this function and pass the file path to that function and it will retun the full base64 string :
here is a simple example :
// Loop through acquired images
window.plugins.Base64.encodeFile(filePath, function(base64){
alert("Base64 image : "+base64);
var base64Data = base64;
//Use this base64 where you wants
});
I hope it will help ypu to convert file to base64 .
have a happy code day

How to use getChangedCells method?

I found that getChangedCells method is somehow applicable to the application that I am building right now.
Can someone show me on how to use getChangedCells method?
Thanks
Regards
Jason
var temp= $("#grid").getChangedCells('all') // Return Rows
or
var temp= $("#grid").getChangedCells('dirty') / Returns the changed cells.
Also try looking at the official docs as #ozczecho mentioned
Check this out. Official documentation. Or a similar question.