March 05, 2004
I have been doing blog designs for a few months and never had a lull until today. Yesterday, I finished up this photoblog design: Southern Views and today I'm unemployed. Must be Bush's fault.

Anyways, just wanted to announce that my services are available, if any one has need of them.

Technical discussion follows:

The biggest challenge in a photo-blog design is sizing the image properly. My goal was to maintain a consistent page display despite differences in image size and orientation. The easy way out is to simply force the image width to the maximum size (600 for this design), but that would cause serious disparity between the height of landscape vs. portrait images.

The solution was a small PHP script which determines the actual width and height of the image. It then decides which dimension is larger and sets that parameter to a pre-set maximum value. Note that this script must be placed after <$MTEntries$> in order to have access to <$MTEntryBody$> which holds the name of the image (sans extension). Here is the script:

<?
  $imgsize = getimagesize('<$MTBlogURL$>/pictures/<$MTEntryBody$>.jpg');
  if($imgsize[0] > $imgsize[1]) {
    $size = "width=600";
  } else {
    $size = "height=450";
  }
  ?>
This gives a PHP variable ($size) which contains either a specific width or height. The image is displayed with the following code:
<img src="<$MTBlogURL$>pictures/<$MTEntryBody$>.jpg" <?=$size ?> border=1>
The best part about this solution is that width:height ratio is not a factor. It assumes a standard 600:450 size, but the displayed image will either be 600 width (with height <= 600) or 450 height (with width <= 450). The same method was used on the navigation thumbnails.

One final note: This particular host does not support Image::Magick, but NetPBM works just fine. Useful instructions regarding getting NetPBM to work with MovableType are available here.

Categories
Archives
March 2010
S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Complete Archives

Tools
Search:
  Advanced Search

Mailing List:



Currently Reading
Recently Read
Animal Farm

Animal Farm
George Orwell

Life of Pi

Life of Pi
Yann Martel

The Fourth K

The Fourth K
Mario Puzo

Catch 22

Catch 22
Joseph Heller

the Sicilian

the Sicilian
Mario Puzo

The Quantum Rose

The Quantum Rose
Catherine Asaro

Members
Sponsors
Blogroll
Links
Stats
Entries: 2147
Comments: 2925
Trackbacks: 665
Members: 258

Most Recent:
  Entry: 11/09/08 9:38
  Comment: 11/17/08 12:27
  Visitor: 03/12/10 6:46

Powered by:
  ExpressionEngine

Extreme Tracking