'') ? 16 : 12;
$width = ' style="width: '.($file_info[0] + $add_width).'px;"';
$class = ($class == '') ? '' : $class.' ';
// if there's a caption
if ($caption <> '')
{
$container_open .= '
'."\n";
$caption = $caption."\n";
$container_close .= '
'."\n";
$width = '';
$class = '';
}
// if there's a link
if ($link <> '')
{
// if it's a link to a larger version of the same image
if ($link == 'large')
{
// get filetype for the larger image
foreach ($filetypes as $type)
{
if (file_exists('/home/d/www/blog/images/large/'.$file.'.'.$type))
{
$ext2 = '.'.$type;
break;
}
}
// if a filetype was found, set the link
if (isset($ext2))
{
$link_start = '';
$link_end = '';
}
else
{
// insert error handling here
// email yourself an error or whatever you want
}
}
// else set the link to the url specified
else
{
$link_start = '';
$link_end = '';
}
}
// build the html
$html .= $container_open;
$html .= '';
$html .= $link_start.'

'.$link_end;
$html .= '
'."\n";
$html .= $caption;
$html .= $container_close;
// send the html back
return $html;
}
?>