function smarty_function_imagesize($params, &$smarty)
{
    // Make sure they passed a source file
    if (!$params['src']) {
        return '<!-- Imagesizer Error: You must specify a source image -->';
    }
    // Get various paths and urls for the image
    if (!($paths = getImagePath($params['src'], $smarty))) {
        return false;
    }
    // Make sure it's a file-type we can deal with
    if (!in_array(strtolower($paths['fileExt']), array('gif', 'jpeg', 'jpg', 'png'))) {
        return '<!-- Imagesizer Error: Invalid file type -->';
    }
    // Calculate the final dimensions
    $finalSize = getNewSize($params, $paths);
    // Do the actual resizing and cache the result
    if (!($finalImage = resizeAndCache($finalSize, $paths, $params))) {
        return '<!-- Imagesizer Error: Could not resize the image -->';
    }
    // Build the options for the img tag
    $opts = 'alt="' . $params['alt'] . '"';
    $opts .= isset($params['class']) ? ' class="' . $params['class'] . '"' : '';
    $opts .= isset($params['id']) ? ' id="' . $params['id'] . '"' : '';
    $opts .= isset($params['title']) ? ' title="' . $params['title'] . '"' : '';
    $opts .= isset($params['style']) ? ' style="' . $params['style'] . '"' : '';
    // Output the tag
    return '<img src="' . $finalImage . '" ' . $opts . ' width="' . $finalSize[0] . '" height="' . $finalSize[1] . '" />';
}
Beispiel #2
0
        if ($item['loai_tin_id'] == 3) {
            ?>
<div class='items-icon'>
	<div class='f-l-tm'>
	<div class='tinnoibat'>
	</div>
		<a href='<?php 
            echo $item['link'];
            ?>
' >
			<?php 
            if (!file_exists("images/property/" . $item['id'] . "/min.jpg")) {
                echo "<img  alt='" . $item['loai_giao_dich'] . " " . $item['loai_bds'] . " " . $item['du_an'] . ", " . $item['quan_huyen'] . ", " . $item['tinh_thanh'] . "' class=\"img_bds_tm\" src='" . JURI::base() . "{$item['image']}' />";
            } else {
                if (isset($_GET['debug'])) {
                    $size_hinh = getNewSize(JURI::base() . "images/property/{$item['id']}/min.jpg", 160, 120);
                    echo "<pre>";
                    print_r(JURI::base() . "images/property/{$item['id']}/min.jpg");
                    echo "</pre>";
                }
                echo "<img  alt='" . $item['loai_giao_dich'] . " " . $item['loai_bds'] . " " . $item['du_an'] . ", " . $item['quan_huyen'] . ", " . $item['tinh_thanh'] . "' class=\"img_bds_tm\" src='" . JURI::base() . "images/property/{$item['id']}/min.jpg' /> ";
            }
            ?>
		</a>
	</div>
	<div class='f-r-tm'>
		<div style='float:left;width:496px'>
				<h4> 
					<a href='<?php 
            echo $item['link'];
            ?>