Exemplo n.º 1
0
 function processImage(&$item, $lazyload = 0)
 {
     $image_arr = array();
     // set $image_arr
     if (!preg_match_all("/\\<img[^\\>]*>/", $item->introtext, $image_arr)) {
         return;
     }
     foreach ($image_arr[0] as $image) {
         // $i_info
         if (!preg_match('#(<img.*)src\\s*=\\s*(["\'])(.*?)\\2(.*\\/?>)#im', $image, $i_info)) {
             continue;
         }
         // replace all image
         $str = preg_replace("/\\<img[^\\>]*>/", '', $item->introtext);
         $str = preg_replace("/<div class=\"mosimage\".*<\\/div>/", '', $str);
         //replace all <p></p>
         $str = preg_replace("/<p><\\/p>/", '', $str);
         // trim introtext
         $item->introtext = trim($str);
         $imagSource = JPATH_SITE . DS . str_replace('/', DS, $i_info[3]);
         if (file_exists($imagSource) && is_file($imagSource) || !strpos($i_info[3], 'http:')) {
             $imgResizeConfig = array('background' => $this->thumbnail_background, 'thumbnail_mode' => $this->thumbnail_mode);
             YTTemplateUtils::getImageResizerHelper($imgResizeConfig);
             $i_src = YTTemplateUtils::resize($i_info[3], $this->width, $this->height, $this->thumbnail_mode);
             if ($lazyload == 0) {
                 return $i_info[1] . "src=" . $i_info[2] . $i_src . $i_info[2] . $i_info[4];
             } else {
                 return $i_info[1] . "src=" . $i_info[2] . JURI::base() . 'templates/' . JFactory::getApplication()->getTemplate() . "/images/white.gif" . $i_info[2] . " data-original=" . $i_info[2] . $i_src . $i_info[2] . $i_info[4];
             }
         } else {
             return '';
         }
     }
 }
Exemplo n.º 2
0
}
?>
 


	
<?php 
if (isset($images->image_intro) and !empty($images->image_intro)) {
    ?>
	<?php 
    $imgfloat = empty($images->float_intro) ? $params->get('float_intro') : $images->float_intro;
    ?>
    <?php 
    // Begin:  The way to resize your image.
    $templateParams = JFactory::getApplication()->getTemplate(true)->params;
    YTTemplateUtils::getImageResizerHelper(array('background' => $templateParams->get('thumbnail_background', '#000'), 'thumbnail_mode' => $templateParams->get('thumbnail_mode', 'fit')));
    $imgW = isset($leadingFlag) && $leadingFlag ? $templateParams->get('leading_width', '300') : $templateParams->get('intro_width', '200');
    $imgH = isset($leadingFlag) && $leadingFlag ? $templateParams->get('leading_height', '300') : $templateParams->get('intro_height', '200');
    $imgsrc = YTTemplateUtils::resize($images->image_intro, $imgW, $imgH);
    //Create placeholder items images
    $src = $images->image_intro;
    if (file_exists(JPATH_BASE . '/' . $src)) {
        $thumb_img = '<img src="' . $imgsrc . '" alt="' . $images->image_intro_alt . '" />';
        $full_img = JURI::base() . '/' . htmlspecialchars($images->image_intro);
    } else {
        if ($is_placehold) {
            $thumb_img = yt_placehold($placehold_size['listing']);
            $full_img = 'http://placehold.it/' . $placehold_size['article'] . '/969696';
        }
    }
    ?>
<?php

defined('_JEXEC') or die('Restricted access');
$countlimit = 2;
$imgResizeConfig = array('background' => '#ffffff', 'thumbnail_mode' => 'stretch');
$model = new VirtueMartModelProduct();
$calculator = calculationHelper::getInstance();
$currency = CurrencyDisplay::getInstance();
YTTemplateUtils::getImageResizerHelper($imgResizeConfig);
$app =& JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
?>

<div class="product-related-products">
	<h3 class="item-title"><?php 
echo JText::_('COM_VIRTUEMART_RELATED_PRODUCTS');
?>
</h3>

	<div id="yt_relate" class="pro_relate">
		<div class="caroufredsel">
		
			<ul id="yt_caroufredsel">
					<?php 
foreach ($this->product->customfieldsRelatedProducts as $field) {
    if (!empty($field->display)) {
        ?>
						<li class="item">
							<div class="spacer">
								<div class="product-header">
									<h3 class="title pull-left">