How to set editable image in MailChimp template via API - api

I made a template with an editable image ("Editable Content Area"), like so:
<img src="http://somewhere.com/foo.jpg" mc:edit="header_image">
When making a new campaign I can replace the image while using the MailChimp editor. But I don't seem to be able to replace the image using the API.
If I include the URL to the image as the section content, it seems to be ignored and the campaign is created without the new image url being set.
content: {
sections: {
header_image: "http://somewhere/else/bar.jpg",
header: "Our latest newsletter",
body: "<p>My fabulous content</p>",
... other named mc:edit section content ...
}
}
All other editable sections (text) are being properly replaced.
Question: How can I set the url of an mc:edit tagged image via the campaigns/create API?

Unfortunately editable content areas are not supported in the MailChimp API. The editable area was made for use within their own editors.
A workaround is to just have an editable content area and to put a full image tag into it via the API.
For example;
content: {
sections: {
header_image: "<img src='http://somewhere.com/foo.jpg'>",
header: "Our latest newsletter",
body: "<p>My fabulous content</p>",
... other named mc:edit section content ...
}
}

Related

How can I add Font Awesome support to Ckeditor5?

I am trying to add Font Awesome support to Ckeditor5-inline and it just removes the "i" tags from HTML when I go in Edit mode.
First download font awesome if you haven't already then
1. Extract the downloaded file (fontawesome.zip) Copy the "fontawesome"
2. folder to "ckeditor/plugins/" folder Open the file
3. "ckeditor/config.js"
configure that like this and clear your browser's cache
config.extraPlugins = 'fontawesome';
config.contentsCss = 'path/to/your/font-awesome.css';
config.allowedContent = true;
In your HTML's section add this code:
<script>CKEDITOR.dtd.$removeEmpty['span'] = false;</script>
after that you can Use toolbargroupname: "FontAwesome" in your toolbar like this
config.toolbar = [
{ name: 'insert', items: [ 'FontAwesome', 'Source' ] }
];
as you commented your are using Django Integration in Django CMS
Django CMS enables adding text-based content to a site using CKEditor which is integrated through the module called djangocms_text_ckeditor. In that module is a static folder and settings.py file, which are setup in a manner that enables fully customizing CKEditor.
you can check here for Django Integration

Notification.Icon loading .png and url fine, but not local file

I'm more trying to understand this than anything, I am not sure if there is an actual solution.
I am using the Notification API (https://developer.mozilla.org/en-US/docs/Web/API/notification) and more specifically this is about the icon property in conjunction with Electron.
I am trying to build a custom notification balloon on Mac and Windows. Everything seems to be pretty straight forward and work, besides the icon part.
This is the issue i am facing (I have verified the file paths exist):
option 1, icon.png (works):
var myNotificiation = new Notification(
title, {
body: message,
icon: jetpack.path(__dirname, 'assets', 'icon.png')
});
option 2, URL (works):
var myNotificiation = new Notification(
title, {
body: message,
icon: "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcR1zOS6CtRHjyHhgclhEKRZ_ipCGU2VCthotUjPp7ErPvSnWb6zZ9fNlA"
});
option 3, local html file (doesn't work):
var myNotificiation = new Notification(
title, {
body: message,
icon: jetpack.path(__dirname, 'services', 'icon.html')
});
For consistency, this is the content of the icon.html page: http://imgur.com/9qkAHky
Question:
Why does the image of the local file jetpack.path(__dirname, 'services', 'icon.html') not populate the icon part of the notification, but the URL image does show up in that same spot?
Any help would be appreciated. I hope its just something simply wrong in my HTML page, but I couldn't find anything wrong yet.
Thanks to Vadim Macagon:
The URL links directly to an image, not an html document, which is consistent with the description of the icon parameter: The icon read-only property of the Notification interface contains the URL of an icon.
This worked for me (source:
https://github.com/electron/electron/issues/1025#issue-54722118)
new Notification({
title: "Message",
body: msg,
icon:'electronImages/hi.png'
}).show()

Difference between Enplug SDK web extension URLs?

I'm using the Enplug SDK web extension to create an app to show digital menus from DSMenu on screens using Enplug. I'm using AngularJS on my config page.
I'm confused about the relationship between the "Configure Url" setting in the back-end from this guide, and the Value.Url in the payload from this tutorial.
Configure URL
Value.Url
$scope.page = {
Value: {
ShowContent: 'url', // Show Content is used to hide/show the Url or Html form field based on the selection.
Url: '', // The Url the web page back-end uses to display the content.
Html: '', // If applicable, used to show custom HTML. Cannot be used in conjunction with the Url.
ShowMobileWebsite: false, //Only applies if OverrideUserAgent is true, False = Show Desktop Website, True = Show Mobile Website
OverrideUserAgent: false, //False = Use android's best fit. True = Use the value of ShowMobileWebsite
ShowDelay: 0, //Custom delay between displaying the page after it's been loaded.
RefreshInterval: 0, // Custom refresh interval rate in X seconds.
AllowJavascript: true, // Set to true by default, allows Javascript to be executed on the page.
Username: '', // Username option, would need to write script passing in credentials.
Password: '', // Password option, would need to write script passing in credentials.
Token: '', // Token option, would need to wrtie script passing in credentials.
JavascriptOnload: '' // Custom JS to be executed once the page loads, can be used to log into authenticated pages.
}
};
I created a page http://www.dsmenu.com/con-enplug-display.php and each app will have a custom URL to show the menu like http://www.dsmenu.com/uph/204. Where do I put each?
The 'Configure Url' is the link to the configuration page which will be displayed to the end user on Enplugs web dashboard, in your example http://www.dsmenu.com/con-enplug-display.php
The Value.Url is the link to the web app that will be shown publicly on the screen in the venue. In your case http://www.dsmenu.com/uph/204

Ember view to display a PDF

In one of my views I would like to display a PDF, which is accesible via URL. This should be done without opening an extra tab in the browser, and without downloading the PDF (to view it outside the browser). It should be visible embedded within the Ember application.
What I have in mind is:
Use the URL to get the PDF and make it accessible to the ember application.
Use a special "PDF view" to display the PDF.
Is this possible? What options do I have to display an embedded PDF in an Ember application?
Displaying a PDF is not really related to ember, because to view a PDF you need a PDF plugin installed in your browser (which is mostly installed by default depending by the browser).
That said, a possible solution I could imagine could be to create a custom ember view with the tagName iframe on which you set the src attribute to the link referring to the PDF.
Example:
App.PDFView = Ember.View.extend({
tagName: 'iframe',
attributeBindings: ['src', 'width', 'height', 'frameborder'],
src: 'pdffile.pdf',
width: 800,
height: 600,
frameborder: 0
});
I've also used width, height and frameborder only for convenience so you can control some of the iframe's attributes easily from within ember. Here a working demo.
You can also go with something more elaborated and use a js lib like http://pdfobject.com/ which you then initialize in your view's didInsertElement hook:
App.PDFView = Ember.View.extend({
src: 'pdffile.pdf',
width: 800,
height: 600,
didInsertElement: function() {
new PDFObject({
url: this.get('src'),
width: this.get('width'),
height: this.get('height')}
).embed(this.get('elementId'));
}
});
(haven't tested the latter, but you get the point)
And then use this App.PDFView like a normal ember view in your templates.
{{view App.PDFView}}
Or your can set the src, width & height directly from within your template like
{{view App.PDFView src="pdffile.pdf" width="600" height="800"}}
Hope it helps.
You can certainly leverage the Ember PDFJS Addon by doing:
ember install ember-pdfjs
The README on GitHub describes the installation and use cases.
In short, the addon provides your Ember project with a component, pdf-document, which you can use in your HTMLBars template like so:
{{pdf-document src=[model.src]}}
... there are other permutations of what src can be (including a string file path, resource URI, or Uint8Array buffer).
If you don't see a feature that you need, please suggest in the Issues.

Google plus api : Share image

Is there any way to share images with description using Google+ public api?
For facebook I use
FB.api('me/images', 'post', {
message: 'My description - http://www.mywebsite.com/mypage',
url: 'http://www.mywebsite.com/path/to/my/image.jpg'
}, function (r) {
alert('SUCCESS');
});
For Google+, I juste have
https://plus.google.com/share?url=https://www.mywebsite.com/mypage
but this just gives a small capture of the image with the information contained in the open graph tags. I want something that gives the same result as if you clic on "Photos" on Google+ and then drag & drop an image then add a description.
Thanks,