Yoz Grahame's Unresolvable Discrepancy

I came here to apologise and eat biscuits, and I'm all out of biscuits

Mo’ blogging, less problems

Posted: July 7th, 2003 | 7 Comments »

Image sent: 200306040032

Brewer St. 10:30 pm.

Those pics up on top of my front page? They’re pictures from my 3G phone, implant sent
in an MMS to an email address which pipes them to this here
perl script wot I wrote
which creates MT entries and thumbnails
and stuff.

(2nd update, more about 9/9/03: POP3 version from Ben, another code patch from Chris)

Notes about usage and development:

  1. Firstly, have some idea how to configure a script and have incoming
    mail piped to it. (I’m assuming basic UNIXy knowledge here) You’ll
    also need a working MT install and, somewhere reachable, the MIME::Tools
    modules. Oh, and obviously this should all be
    done on the same machine. (i.e. the machine that publishes your blog
    should also be capable of receiving email) (UPDATE: If you have blog and email on separate machines, Ben Milleare’s POP3 version may be the thing for you)
  2. Download the script and set the variables at the start. You’ll
    also need to make a directory for the unpacked MIME files to go into.
  3. You may want to make a new MT category for pictures, which makes it
    much easier to do tricks like my picture bar. The code for it looks like this:


    <MTEntries lastn="4" category="pic">
    <$MTEntryExcerpt$>
    </MTEntries>

    … since it’s the entry excerpt that holds the clickable thumbnail.
    Once you’ve made the category, put its ID number into the $CAT_ID constant
    at the top of the code. If you don’t want to use category-setting, set it to 0.
    (Oh, and you’ll want to edit your main MTEntries tag on
    the Main Index to use every category except the picture one.)

  4. Unfortunately, there aren’t currently any logging or
    debugging facilities for the script beyond those that your MTA or
    perl environment provide. However, I found that testing by piping
    a pre-saved mail from a file was enormously helpful. (Well, more
    helpful than having to work my way through my phone’s abysmal
    message-sending interface and then sifting through the mail logs
    for errors every time, anyway)
  5. Once you’re sure it works, set up your mail handling in procmail
    or whatever. Since I use qmail
    (for reasons beyond my control) I have a .qmail-... file
    that merely contains the line

    |/home/yoz/ym.pl

    There should probably be a preline in there, but it seems
    to work fine without it.

  6. I say above that it’s built for handling MMS (Multimedia Message
    Service) mails from phones and the like, but it’ll handle any mail with
    an image attachment. (As long as there’s only one image. I should probably
    fix that.) If there’s some
    text in the body (not the subject) it’ll handle that too, using
    it as a title for the entry, the A tag and the value of the ALT attribute.
  7. Thanks to Chris Carline, the subject line can be used to rotate the image if your phone can’t do that for you.
    Send “t” to rotate 90 degrees anti-clockwise or “tc” for 90 degrees clockwise.
  8. Yes, okay, it’s a badly-hacked-up piece of shite, but it appears
    to work. I didn’t use XML-RPC or any of that nonsense because firstly
    it seemed a terribly roundabout way of getting some perl to call some
    other perl and secondly because I wanted it to do some thumbnailing
    and stuff. And okay, when I had this script half-written
    Cory showed
    me a Python one that was already done but I was too far into this one
    to care, and besides, that one didn’t do thumbnailing. Credit must
    go to Olivier
    Mueller’s script
    for inspiration
    and also to Azeem for
    irritating me into thinking about this in the first place.
  9. Thus, there is no license and no guarantee. Caveat haxxor. If it
    breaks in half, you own both pieces. Please don’t use it to kill
    people, though mortal embarrassment is fine (and, frankly, inevitable).

7 Comments on “Mo’ blogging, less problems”

  1. 1 qB said at 10:54 pm on July 8th, 2003:

    I wish I understood more than just the title of this post. If I had a cameraphone I would want to be moblogging to MT _really_ badly. And who knows… the new Handspring/Palm thingy is singing a Siren song…. (as well as ringing polyphonic ring tones)

  2. 2 Yoz said at 3:39 pm on July 9th, 2003:

    Sorry, it’s all very techie – unfortunately, hooking anything up to a mail recipient usually gets nasty. 🙁

  3. 3 James said at 6:04 pm on November 7th, 2003:

    add this if you don’t want the script to break when you install extra MT modules
    use lib “$MT_DIR/extlib”;

  4. 4 Damian Bierman said at 6:38 am on December 21st, 2003:

    yoz & ben, thanks for this!
    things were going fine till my t630 shit the bed, and i decided to go instead with the Samsung e715. problem was, the jpegs the samsung spits out doesn’t play nice with your script (in particular, the MT::Image module), giving this to errstr when it tries to make the thumbnail:
    ——————-
    Reading file ‘pic.jpg’ failed: Exception 325: Invalid SOS parameters for sequential JPEG (pic.jpg)
    Can’t call method “scale” on an undefined value at ./mt-moblog.pl line 132.
    ——————-
    what to do? use another thumbnail module. for no particular reason other than it was the first one google turned up, i chose Image::Thumbnail by L. Goddard. so to get things going basicaly all i did was replace the MT::Image thumbnail code with this bit:
    —————-
    my $img = new Image::Thumbnail(
    size => $WIDTH,
    create => 1,
    inputpath => $imagepath.$imgext,
    outputpath => $imagepath.”_t”.$imgext,
    );
    —————-
    and everything works again. probably not necessary for most, but for those whose phones spit jpegs out in a format that MT::Image can’t handle, the above hack will get you going again.

  5. 5 Abbi said at 12:16 pm on September 15th, 2004:

    i should admit that you have a lovely site. Please accept my compliments!

  6. 6 Scooterphish said at 4:19 am on November 25th, 2004:

    RE: #6 when you say “As long as there’s only one image”, you mean for MMS as well as email? Just curious, as tmo has changed their MMS format to include a little web page w/ a spacer gif, and some other jpg (kinda like what SprintPCS does)…

  7. 7 Yoz said at 12:01 pm on November 25th, 2004:

    Yep, given that it expects MMS to come in as email anyway. If there’s more than one image it’ll still only return one which may well be the wrong one, so it’s worth a try to see what it does. I’m rather short on coding time at the moment – if you want to have a go at patching it, feel free. Otherwise, send me an example MMS mail and I’ll see what I can do.

Archive

The complete list of posts lives here.

yoz's bookmarks

  • How to win a grant 2013/07/22
    "Skip the long-winded argument on why your idea—your life’s work—deserves institutional support, and instead do this:"
  • Bullies Called Him Pork Chop. He Took That Pain With Him And Then Cooked It Into This. 2013/04/12
    Amazing multi-artist video for Shane Koyczan's poem about being bullied.
  • learnfun and playfun: A general technique for automating NES games 2013/04/11
    Algorithmically analysing recorded gameplay and in-memory value increments to ascertain scoring techniques. The video is fantastic and funny, and the algorithm finds some useful bugs in the games.
  • How we use Redis at Bump - Bump Dev Blog 2011/07/16
    How Redis became Bump's Swiss Army Knife to solve all kinds of data-related problems
  • Heroku | The New Heroku (Part 4 of 4): Erosion-resistance & Explicit Contracts 2011/06/29
    Fascinating description of how Heroku's recent changes are aimed at killing software erosion (or what I think of as "bitrot").
  • What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about? - Quora 2011/06/17
    Marvellous collection of JS, CSS & HTML hacks. Did you know you can get the browser to parse a URL or escape HTML for you, with existing JS functions? (via gnat)
  • Avatars In Motion 2011/05/21
    "This blog is to show all the beauty you can find in Second Life." Gorgeous photography of great SL locations. (via Hamlet)
  • Gabe Newell on Valve | Game development | Features by Develop 2011/05/14
    Great, inspirational interview on how they hire and organise.
  • Design @ Quora (Web2.0 Expo Presentat... by Rebekah Cox - Quora 2011/05/03
    "Great design is all the work you don't ask the people who use your products to do."
  • David Kelley on Designing Curious Employees | Fast Company 2011/04/20
    "In this interview, he explains why leaders should seek understanding rather than blind obedience, why it’s better to be a coach and a taskmaster and why you can’t teach leadership with a PowerPoint presentation."

yoz on twitter

    follow me on Twitter

    Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org

    Content licensed under the Creative Commons (Attribution - Share Alike) | Theme based on Clean Room by Columbia, MO Web Design