Jay Knight

  • About

Pasting images in tinymce

October 31, 2011

I've been looking for an improved experience with tinymce for some projects at work.  I'm finding that a lot of the problems we have can be solved with options and plugins that are built into it. I guess reading the manual can come in handy from time to time. One thing that would really be nice is pasting or dragging images into the editor and being able to save it along with the text.  After a little experimenting, I found that in Firefox you can do just that. Unfortunately this is a Firefox-only method right now, but it's better than nothing.

If you have an image on the clipboard, and you paste in a tinymce instance, it will insert the image by adding an <img> tag with a data: url as the src attribute (this also works with dragging image files from your computer into the editor).  Since it's embedded in the html, it gets submitted inline when the form is submitted.  Since data: urls don't work with some browsers, and large images would cause slow page rendering, I whipped up this little (php) function to save the images to disk and update the <img> tag to refer to them:

I use a directory based on the id of the object that is being edited and the md5 as the filename.  It's not that fancy, but I think it works.  I haven't done a huge amount of testing on it, so I'm not completely sure that the html->DOM->html process won't mess up other stuff in your document.

I'm also thinking about a method of using the html5 file API in tinymce to make similar behavior work in other browsers. Any ideas?

Continue reading

New Blog

August 25, 2011

It's been almost 2 years since I've posted anything here... and quite a bit longer since I've posted anything that's at all interesting :-\  However, I've begun a new blog over at http://jayknight.com/.  As you'll quickly see, that blog is going to be about Christian-y things... things that have to do with my searching for, and likely conversion to, Orthodox Christianity.  I do intend to keep this blog going as well and post interesting things I find online or geeky things regarding programming, photography, and maybe a bit of politics. So stay tuned (but don't hold your breath).

Continue reading

Tomatoes are Delicious

September 27, 2009

I just updated my router (Linksys WRT54GL) with the Tomato Firmware. Here are my initial observations:

  1. The upgrade was much faster and easier than I was anticipating. After writing down some settings I had with the default firmware, I flashed the router. A couple minutes later, I was in the tomato interface completing the last of the installation steps and configuring my wireless network.
  2. The first thing I noticed was that my laptop (connected via wifi) is noticeably faster loading web pages. I think it had been having trouble with DNS lookups. I don't know exactly what is different now, but that was a nice bonus.
  3. I boosted the wireless transmit power (from 42 to 84 dB), and am now (finally) able to get wifi throughout my house. I walked to the farthest corners of my house and still had a very usable connection.

I haven't yet played with the more advanced settings (other than boosting wifi power), but so far I am quite impressed.

Continue reading

Google Earth: Memphis in 3D

March 2, 2009

This is the view from my office taken with my G1:

Photo View

This is the view from my office according to Google's new 3D buildings in Downtown Memphis:

Photo View

Have I ever mentioned that technology is freaking amazing?

Continue reading

California Trip

November 11, 2008

Vista
Janna and I (and Janna's mom) spent last week in California hanging out with our niece and nephews while their parents were out of town.  We had a lot of fun, and did neat things, like going to Death Valley, Hollywood, and  seeing giant sequoia trees: things you don't see in the Mid-South. It reminds me that there are lots of wonderfully unique places in this world, and I hope I get to see a few more of them someday. I've posted a few pictures of the trip up on flickr for your enjoyment.

Continue reading
Next

Powered by Jekyll with Type Theme