Pasting images in tinymce

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?

New Blog

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).

Tomatoes are Delicious

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.

California Trip

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.

Vote For Someone Else (.com)

Ever since it was pretty clear that Ron Paul would not be the Republican nominee, I’ve planned on voting for someone who is not John McCain or Barack Obama.  I’ve learned enough over the past year and a half to realize that neither of those represents the kind of change this country needs, and in fact are exactly the same in all of the important fundamental issues that we face.

The other day, Dr. Paul held a press conference with all most of the “other” national candidates and urged voters to reject the two-party system by voting for someone else.  He came together with those four candidates to agree on four principles that set them apart from the established candidates.

So, in light of that, I’ve thrown up a new site: voteforsomeoneelse.com.  It’s a blog-type thing where I’ll be posting news and thoughts that will hopefully convince a few people to not vote for the status quo.   Let me know your thoughts and suggestions.

Special Thanks to: The very fitting theme is by an old colleague, thanks James!

We’re Moving!

Our New HouseIt is absolutely amazing how fast things can happen.  Only a few weeks ago Janna and I decided to start the process of relocating to the Memphis area.  We put our house on the market and started to casually look at houses to buy.  Considering all the mess with the housing market, we expected for our house to sit on the market for a month or two until we lowered the price enough for someone to bite.

We could not have been more wrong.  In less than a week, we had an offer that we could simply not turn down and — despite not really being mentally prepared to do so — we accepted it.  That put the pressure on, we had to find a place to move to one month later…. So the next weekend (this past weekend) we spent most of the day Saturday looking for a house.  There were a lot of houses that would have been good for us that we could afford, but most were nothing really special.   But in the afternoon we happened upon one that was simply charming and very fitting for us.  We made another appointment to see it again that night with our parents, and they were as amazed as we were.  The next afternoon we met with our Realtor to put together an offer.  Our realistic expectations did not expect them to come back the next morning and accept.  But, of course, this post is all about us being very wrong.

So, there you have it…. in about three weeks, we have gone from considering moving to selling one house and buying another.  We’ll be moving into our wonderful home in Bartlett on July 12.  Let’s just hope the rest of the process goes as unexpectedly smooth as it has so far.

We will miss Oxford pretty sorely.  We’ve been here for four years, and I was mostly here the six years prior to that.  We have had unbelievable oppurtunities here, and have simply fallen in love with this place.  I don’t doubt that life will be grand in Bartlett, but I know it will never be Oxford.  We have wonderful friends here that we will be sad to see less often, and our little house has treated us so nice… It will be hard to leave.

If you are one of the two people that reads this blog, we would like to invite you to our new home.  If you’re coming from Oxford, bring some Ajax.