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.

Big News

For anyone who may not have heard, I have accepted a position with St. Jude Children’s Research Hospital in Memphis, TN, and will be starting On April 7. I’m pretty excited about it, I’ll be working with a very talented team on some interesting web sites that are aimed at the international medical community. For the past few months, I’ve been doing some work with them on the side and have really enjoyed it (though I’ve found that “on the side” is not my favorite way to work, I enjoy having evenings work-free).

I’ve enjoyed my almost four years with D2 Interactive/US Networx, but this is a great opportunity and will lead me to greater things. For the time being, Janna and I will be staying in Oxford and I’ll commute to Memphis (Here’s hoping Bernanke stops devaluing the dollar so I can afford the gas).

On top of that exciting news, We’re leaving for the Bahamas next week for my cousin’s wedding. Let’s just say that my motivation to get anything done is less than spectacular right now, which you can tell because I wrote this post on the clock :)

Lighting Up Lady Liberty

The last week of August, Dr. Ron Paul’s presidential campaign set a goal to raise half a million dollars before the end of the month and the third quarter. After about 3 days, that goal was reached and double to one million dollars. When the quarter ended, the online donations for that last week was $1.2 million and the quarter total was over $5 million! That’s really awesome, but the real interesting part is the unprecedented transparency of the funds raised.

For that challenge, they put up a flash app with a thermometer that showed the progress of the fund raising that updated in (near) real time, showing the exact total and the name and location of recent donors. Paul fans web wide were glued to their browser that week watching the amazing speed of the mercury rising.

This quarter, the campaign is continuing the openness by “letting everyone track our progress throughout the quarter – the first campaign in history to disclose immediately every cent that is raised.” But not only can you see the current total on Ron Paul’s site, in the form of “Lighting Up Lady Liberty”, but a few people are aggregating this data and making it available in the form of some neato graphs.

Update: I’ve made a Live Title generator that will display the total raised for the quarter as the bookmark title.

And to the Republic

My fairly recent newfound interest in politics has led me to read up on and follow things that has always either bored or saddened me (much of it still does). In the course of keeping up with the latest goings on, I ran across this little blog post noting the differences between a democracy and a republic. The line between them has been blurred into invisibility in today’s culture, but the founders understood the contrast very well and warned against a democratic government.

So, I’ll have to learn more about this: It’s nice to have a good, simple, definition-based way to express some of the things that have been swimming aimlessly in my head. It’s also funny to juxtapose these terms with our political parties that claim them as namesakes. I’m finding it hard to figure out exactly how they justify calling themselves either.