/**
 * Gives an image tag for an asset
 *
 * @param  sfAsset $asset
 * @param  string  $thumbType
 * @param  array   $options
 * @param  string  $relativePath
 * @return string
 */
function asset_image_tag($asset, $thumbType = 'full', $options = array(), $relativePath = null)
{
    $options = array_merge(array('alt' => $asset->getDescription() . ' ' . $asset->getCopyright(), 'title' => $asset->getDescription() . ' ' . $asset->getCopyright()), $options);
    if ($asset->isImage() || $asset->isPdf()) {
        $src = $asset->getUrl($thumbType, $relativePath, $asset->isPdf());
        if ($asset->isPdf() && !is_readable(sfConfig::get('sf_web_dir') . $src)) {
            $src = '/sfDoctrineAssetsLibraryPlugin/images/pdf.png';
        }
    } elseif ($thumbType == 'full') {
        throw new sfAssetException('Impossible to render a non-image asset in an image tag');
    } else {
        switch ($asset->getType()) {
            case 'txt':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/txt.png';
                break;
            case 'xls':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/xls.png';
                break;
            case 'doc':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/doc.png';
                break;
            case 'pdf':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/pdf.png';
                break;
            case 'html':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/html.png';
                break;
            case 'archive':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/archive.png';
                break;
            case 'bin':
                $src = '/sfDoctrineAssetsLibraryPlugin/images/bin.png';
                break;
            default:
                $src = '/sfDoctrineAssetsLibraryPlugin/images/unknown.png';
        }
    }
    return image_tag($src, $options);
}
/**
 * Gives an image tag for an asset
 * 
 * @param sfAsset $asset
 * @param string $thumbnail_type
 * @param bool $file_system
 * @param array $options
 * @return string
 */
function asset_image_tag($asset, $thumbnail_type = 'full', $options = array(), $relative_path = null)
{
    $options = array_merge(array('alt' => $asset->getDescription() . ' ' . $asset->getCopyright(), 'title' => $asset->getDescription() . ' ' . $asset->getCopyright()), $options);
    $src = $asset->getImageSrc($thumbnail_type, $relative_path);
    return image_tag($src, $options);
}