tinyMCE base64 Image and storing to mySQL database - tinymce

I am experimenting with tinyMCE and a have a few questions. Using their image handler which inserts an image into the textarea. I use echo $_POST['textarea'] to verify it displays properly on a web page, and it does.
Looking at the HTML code in the browser webconsole, I see the image referenced as: <img title="IMG_1908.JPG" src="data:iamge/jpeg;base64,/9j/4s/...>
A few questions:
Is this image reference actually a base64 image and not just a reference link? How can I see this?
Where does this image "file" actually reside?
If I just saved the data represented by $_POST['textarea'] into a database field, would it capture the entire contents in the database so I can just retrieve it and echo it? Should it be a BLOB field?
Thanks in advance!

Answers:
The firefox web console is a little misleading as it truncates the actual Base64 data, making it look like a short reference link, when in fact, it is typically super long showing all the base64 data characters.
Looking at the web browser's page source actually shows the base64 image in it.
Yes, the tinyMCE HTML form textbox named as 'textarea' can be saved using the $_POST['textarea'] global variable, into a mySQL BLOB field, then can retrieve the same field and echo it to display it again. The echo shows the exact same format that was seen in tinyMCE during input.

Related

In TinyMCE is there a feature to allow pasting images when using the backend image load handler which saves uploaded images on the server?

I'm using the image upload script with a backend URL to rename uploaded images stored on the server. It seems to work well with both file uploads and also drag-and-drop.
Without that backend handling you can paste images directly into the editor, but they get saved as base64 with the post in the db itself which is not great for a lot of reasons.
If I use the image upload script as I am now, it seems it blocks the pasting of images directly into the editor. That's safest, I guess, but I was wondering if there was a way of allowing it, but treating the pasted image like a drag-and-drop image, for example, so we could have the convenience of pasting images but still have them saved with unique filenames on the server instead of being embedded as base64 with the rest of the source of the post?
Thanks.

How to get/save data from database using draft-js

I decided to raise the issue here. I use mysql as the database as a storage and would like to add draft-js into the web page I am building now. What is the correct way of getting and saving data into the database? Any working examples would be great!
You should use convertToRaw and convertFromRaw methods. Extracts from documentation:
convertFromRaw(rawState: RawDraftContentState): ContentState
Given a raw state, convert it to a ContentState. This is useful when
restoring contents to use within a Draft editor.
convertToRaw(contentState: ContentState): RawDraftContentState
Given a ContentState object, convert it to a raw JS structure. This is
useful when saving an editor state for storage, conversion to other formats, or other usage within an application.
I forked this pen for demonstration how these methods work. Open my pen. First, let's consider a saving editor state. I added "Log editor state" button. If you open console and click on the button, you can see current representation of editor state as JavaScript object. You can convert this object to JSON and save this JSON in your database using the appropriate API endpoint.
click to image for full size
The case when you need to show your editor on the page not empty, with a predefined content which you had previously saved in database or, for example, localstorage. Here, you should use createWithContent method and mentioned above convertFromRaw method. In my example I stored JSON string in the variable editorStateAsJSONString, for a real-world case you should request API endpoint, which returned JSON, and, after it, render the editor component as described.

coldfusion show pdf on page

I know coldfusion has extensive pdf support, but I'm not sure if this is possible.
I was given a pdf form and told to make it so it is both filled out online, the data is captured, and the form can be printed.
Obviously, I can create an html page that looks like the document, save everything, generate the filled pdf form, etc.
Alternately, I think I can show the pdf, have them fill it, then grab the form data. I'm not entirely sure I can do this though, because I would need to detect when they are done filling it out.
But I was thinking it would be nice if I could do it this way - Show the pdf embedded on the webpage, let them fill it out and print it, then capture everything when they are done. I was looking through the CF documentation (cfpdf cfhttp, etc), but not finding exactly what I need. Is this an option?
You can extract the data from a PDF using the cfpdfform tag or as an HTTP Post. Here's a link to the docs on how to do that, but it depends on how you set up the PDF itself. You can edit your PDF form to actually submit just the formdata to a given CF page. It arrives on the page in a struct tied to the form name (ie. #form.form1.Fields.blah# etc.). Dump it out to deipher it (it's kind of convoluted) So you could fire print and submit from within the PDF.
The second way is to submit the PDF itself as a file. In this case you use the cfpdform tag - not well documented or widely used. Both approaches are covered lightly in the link above. Good luck!
We can show the pdf on page using cfheader and cfdocument tags. We can only show the pdf on webpage using the following example code.
<cfsavecontent name="pdfcontent">
//Here what you need to show the pdf
</cfsavecontent>
<cfheader name="Content-Disposition" value="filename=Mydocument.pdf">
<cfdocument format="pdf" orientation = "landscape" bookmark="Yes" marginleft=".25" marginright=".25" marginTop = ".25" marginbottom=".75" scale="90">
<cfoutput> #pdfcontent# </cfoutput>
</cfdocument>

Send a base64 image in HTML email

Using a rich-text editor, our users can drag and drop a saved image from their desktop to the editor. The image appears and displays properly in the web page after they submit.
Since the image is not uploaded anywhere, the editor saves the image as a base64-encoded image.
<img alt="" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA4QAAAFKCAIAAADKUQaBAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAP+lSURBVHhepP1p32zb
etc.
But it doesn't show up - not on the iPhone, nor two different versions of Outlook. The image is simply broken. We want to stick with base64 due to it already working with the web page and the ability to view an image if the user is offline.
Support, unfortunately, is brutal at best. Here's a post on the topic:
https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/
And the post content:
An alternative approach may be to embed images in the email using the cid method. (Basically including the image as an attachment, and then embedding it). In my experience, this approach seems to be well supported these days.
Here's a little more reading: https://sendgrid.com/blog/embedding-images-emails-facts/

Filemaker html to image conversion

I have HTML code inside the database but while retrieving HTML code I wants to convert it into image.Their is any plugin which can convert HTML code to image???
Please reply...
You could use a Web Viewer to render the HTML then take a screenshot of selected coordinates using ScriptMaster's "Screen Capture" module.