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?
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).
I just updated my router (Linksys WRT54GL) with the Tomato Firmware. Here are my initial observations:
- 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.
- 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.
- 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.
This is the view from my office taken with my G1:
This is the view from my office according to Google's new 3D buildings in Downtown Memphis:
Have I ever mentioned that technology is freaking amazing?
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.