• Skip to main content
  • Skip to primary sidebar
  • My Social Media
  • About
    • About Mark Draughn
    • Testimonials
    • Other Authors
      • About Gary Olson
      • About Ken Gibson
      • About Joel Rosenberg
    • Disclosures
    • Terms and Conditions

Windypundit

Classical liberalism, criminal laws, the war on drugs, economics, free speech, technology, photography, sex work, cats, and whatever else comes to mind.

Another Fight With Movable Type

July 16, 2009 By Mark Draughn Leave a Comment

So there I was, writing a short post about something, when I needed to embed an image. I cliecked the “Insert Image” button in my Movable Type blogging software, uploaded the image, and…it wouldn’t let me create a thumbnail image.

Thumbnailing is done by the Perl Image::Magick module and, sure enough, when I checked Movable Type’s listing of the status of Perl modules, it displayed an error:

Image::Magick

Your server does not have Image::Magick installed, or Image::Magick requires another module that is not installed. This module is needed if you would like to be able to create thumbnails of uploaded images. Please consult the installation instructions for help in installing Image::Magick.

I logged a trouble ticket with my hosting service, and in a few minutes Diego had re-installed Image::Magick. He said it passed all the tests, and I’m inclined to believe him, but it didn’t fix my problem.

It was time to poke around in the guts of Movable Type to see if I could find anything that could cause this. First, however, I decided to upgrade to the latest version of Movable Type. Why tinker with an old version which I’d only be replacing anyway? Besides, the upgrade might fix the problem.

So I downloaded MT version 4.261, dumped it into the appropriate directory, and ran the upgrade script. Everything worked fine. Or so it seemed.

A few minutes later, I noticed that if I clicked through to the permalink on one of my posts, I got an error message instead of the blog content. E.g.:

Page not found – /archives/2009/07/still_searching_for_that_elusi.html

Not good. Nobody could comment, or even read an article that they’d found by searching.

Now I logged a trouble ticket with Movable Type. The response was surprisingly fast, and included a couple of suggestions…which didn’t actually help fix the problem.

Meanwhile, I tried restoring the old version of the PHP page rendering engine, since that’s what was spitting out the error message. Ta Da! Everything worked fine again.

I downloaded both the old and new PHP rendering directories and did a diff across all the files. Then I probed for the problem by first swapping in groups of new files until I found the problem in the database code. Then I swapped in individual database code files until I had narrowed it down to the “/php/lib/mtdb_base.php” file.

Finally, I swapped in bits of new code until I found the problem in the resolve_url() function. The highlighted line is the bad one:

    function &resolve_url($path, $blog_id) {         $path = preg_replace('!/$!', '', $path);         $path = $this->escape($path);         $blog_id = intval($blog_id);         # resolve for $path -- one of:         #      /path/to/file.html         #      /path/to/index.html         #      /path/to/         #      /path/to         global $mt;         $index = $this->escape($mt->config('IndexBasename'));         $escindex = $this->escape($index);         foreach ( array($path, urldecode($path), urlencode($path)) as $p ) {             $sql = "                 select *                   from mt_blog, mt_template, mt_fileinfo                   left outer join mt_templatemap on templatemap_id = fileinfo_templatemap_id                  where fileinfo_blog_id = $blog_id                        and [1]                    and blog_id = fileinfo_blog_id                    and template_id = fileinfo_template_id                    and template_identifier != 'backup'                  order by length(fileinfo_url) asc             ";             $rows = $this->get_results(sprintf($sql,$p), ARRAY_A);             if ($rows) {                 break;             }         }         $path = $p;         if (!$rows) return null;          $found = false;         foreach ($rows as $row) {             $fiurl = $row['fileinfo_url'];             if ($fiurl == $path) {                 $found = true;                 break;             }             if ($fiurl == "$path/") {                 $found = true;                 break;             }             $ext = $row['blog_file_extension'];             if (!empty($ext)) $ext = '.' . $ext;             if ($fiurl == ($path.'/'.$index.$ext)) {                 $found = true; break;             }             if ($found) break;         }         if (!$found) return null;         $data = array();         foreach ($row as $key => $value) {             if (preg_match('/^([a-z]+)/', $key, $matches)) {                 $data[$matches[1]][$key] = $value;             }         }         $this->_blog_id_cache[$data['blog']['blog_id']] =& $data['blog'];         return $data;     } 

I don’t really know what that line does, or why, but removing it fixed the problem and didn’t seem to break anything else (that was obvious). Problem solved.

[Update: Movable type has let me know that the best solution is to change the line in red to read

and template_type != ‘backup’

I tried it, and that did the trick.]

Of course, none of this fixed my original problem. Image::Magick still didn’t work.

I just gave up. It turns out Movable Type can use alternative graphics libraries, so I switched to one of those.

I never did finish the original post.


Footnotes

  1. fileinfo_url = ‘%1$s’ or fileinfo_url = ‘%1$s/’) or (fileinfo_url like ‘%1$s/$escindex%%’ ↩

Filed Under: Uncategorized

Reader Interactions

Leave a ReplyCancel reply

Primary Sidebar

Search

Recent Posts

  • Swift Falling
  • Renovations
  • A familiar war in Iran
  • On the shooting of Renee Good
  • Swift Descending
  • GOA on Trump
  • Yes, It’s a Bribe
  • Talking to my fellow libertarians about DOGE

Where else to find me

  • Twitter
  • Post
  • Mastodon

Bloggy Goodness

  • DrugWar Rant
  • Hit & Run
  • Honest Courtesan
  • Nobody's Business
  • Popehat

Blawgs

  • appellatesquawk
  • Chasing Truth. Catching Hell.
  • Crime & Federalism
  • Crime and Consequences Blog
  • Criminal Defense
  • CrimLaw
  • D.A. Confidential
  • Defending People
  • Gamso For the Defense
  • Graham Lawyer Blog
  • Koehler Law Blog
  • Legal Satyricon
  • New York Personal Injury Law Blog
  • Norm Pattis
  • Probable Cause
  • Simple Justice
  • Tempe Criminal Defense
  • The Civil Rights Lawyer
  • The Trial Warrior Blog
  • The Volokh Conspiracy
  • Underdog Blog
  • Unwashed Advocate

Bloggers

  • Eric Zorn
  • ExCop-LawStudent
  • InstaPundit
  • Marathon Pundit
  • Speakeasy Blog
  • SWOP Chicago

Geek Stuff

  • Charlie's Diary
  • Google Blogoscoped
  • Schneier on Security
  • The Ancient Gaming Noob
  • The Daily WTF
  • xkcd

Resources

  • CIA World Factbook
  • Current Impact Risks
  • EFF: Bloggers
  • Institute for Justice
  • Jennifer Abel
  • StrategyPage
  • Wikipedia
  • WolframAlpha

Frozen in Amber

  • a Public Defender
  • Agitator
  • Bert P. Krages II
  • Dan Heller
  • Defending Dandelions
  • Indefensible
  • Last One Speaks
  • Leslie's Omnibus
  • not for the monosyllabic
  • Not Guilty
  • Preaching to the Choir
  • Ravings of a Feral Genius

Copyright © 2026 Mark Draughn · Magazine Pro On Genesis Framework · WordPress