Random Musings III

Sir, this area is just for waiting

After just having returned from a month researching my family in Italy (we were able to trace our family back to 1200 when previously we couldn’t get past 1860), I noticed the prevalence of the green man over The States’ preference for the red word “Exit”. But I also saw a number of signs that I felt were funny. Here’s one for the “waiting area” of an airport. In a place where iconography is especially important due to so many international speakers around, I initially thought this was a sign for the bathroom.

And this seat is reserved for mutilated people

OSCommerce Image-resizing Error

This is from an excerpt of an email that Mike, our tech lead, sent to a client. And while it’s a little dry, I thought it might help others who are experiencing the same issue. [d]online’s most visited pages are the ones that reference issues and errors with code (“Flash Cookies“, “Use Direct Mode“, “Best Practices to Keep your Inbox, Voicemail and Mailbox Free of Spam“) and informational resource pages (“Flash File Uploader“).

I didn’t see any particular fix posted at any of the links that were coming up [from a Google search], but it seems like the function that OSC[ommerce] used to use for resizing has stopped working (perhaps due to changes in server configuration, perhaps simply due to code deprecation).Anyhow, if you want the technical details, read on. If not, you can simply be comforted in the fact that it seems to be working without issue, now.

The code: \admin\includes\functions > html_output.php

if (!file_exists($filename_small) || filemtime($src) >
filemtime($filename_small)) {copy($src, $filename_small);
exec("mogrify +profile \"*\" -filter Lanczos -quality 75 -geometry " . $width . " \"" . $filename_small ."\"");

// this reduces the file size of the original image

exec(" mogrify -geometry x400 -quality 75 +profile \"*\"
$src");
}

Those shell exec requests to ImageMagick are being ignored. I’m using GDLib now to do the resizing, simply changing the above statements to:

if (!file_exists($filename_small) || filemtime($src) >
filemtime($filename_small))
{ copy($src, $filename_small);
resampimagejpg($width, $height, $src, $filename_small, 1);
}

And adding a simple image resizing function to the bottom of the script — one that we had written a while ago for a photo gallery tool:

function resampimagejpg($forcedwidth, $forcedheight, $sourcefile, $destfile, $imgcomp)
{     $g_imgcomp=100-$imgcomp;
$g_srcfile=$sourcefile;
$g_dstfile=$destfile;
$g_fw=$forcedwidth;
$g_fh=$forcedheight;
if(file_exists($g_srcfile))
{
$g_is=getimagesize($g_srcfile);
if(($g_is[0]-$g_fw)>=($g_is[1]-$g_fh))
{
$g_iw=$g_fw;
$g_ih=($g_fw/$g_is[0])*$g_is[1];
}
else
{
$g_ih=$g_fh;
$g_iw=($g_ih/$g_is[1])*$g_is[0];
}
$img_src=imagecreatefromjpeg($g_srcfile);
$img_dst=imagecreatetruecolor($g_iw,$g_ih);
imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $g_iw, $g_ih, $g_is[0], $g_is[1]);
imagejpeg($img_dst, $g_dstfile, $g_imgcomp);
imagedestroy($img_dst);
return true;
}
else
return false;
}

I realize both the native OSC code and the new function are both comparing sides of the image to decide which length to prefer in the resize. This isn’t likely to have any loss in efficiency, and it could be helpful if we are to make changes to this in the future, simply to keep it intact for the time being. You should know that the new server will need to have GDLib installed, or this function, too, may fail.

5-year-old Actors in NYC

Lastly, I’m looking for 5-year-old male actors in the NYC area that are interested in acting in a series of viral videos for the promotion of a new book that’s coming out this September. The videos will probably feature the actor doodling scenes from the book on a sheet of paper while humming and will only show the actor’s hands. As such, girls may also be considered. Write us here, if interested.

2 Replies to “Random Musings III

  1. I wish I could say “Yes” but we were lucky to have a family that wrote everything down over the years and carefully saved and reproduced everything. It’s a ton of information to pore through, but we’re grateful to have it. Sadly, I’m sure this won’t be of assistance to you.

Leave a Reply

Your email address will not be published. Required fields are marked *