Example #1
0
 public function renderThumb($path, $width = 280, $height = 150, $isThumb = true, $quality = 100)
 {
     if ($isThumb) {
         $path = str_replace(JURI::base(), '', $path);
         $imagSource = JPATH_SITE . '/' . $path;
         $imagSource = urldecode($imagSource);
         $tmp = explode('/', $imagSource);
         $imageName = md5($path . $width . $height) . '-' . $tmp[count($tmp) - 1];
         $thumbPath = $this->_thumbnailPath . $imageName;
         if (file_exists($imagSource)) {
             if (!file_exists($thumbPath)) {
                 //create thumb
                 BTImageHelper::createImage($imagSource, $thumbPath, $width, $height, true, $quality);
             }
             return $this->_thumbnaiURL . $imageName;
         } else {
             if (!file_exists($thumbPath)) {
                 // Try to load image from external source
                 // Image loaded?
                 if ($this->_CreateImageUsingCurl($path, $thumbPath, 30)) {
                     BTImageHelper::createImage($thumbPath, $thumbPath, $width, $height, true, $quality);
                     return $this->_thumbnaiURL . $imageName;
                 }
             } else {
                 return $this->_thumbnaiURL . $imageName;
             }
         }
     }
     //return path
     return $path;
 }
Example #2
0
 public function renderThumb($path, $width = 280, $height = 150, $isThumb = true)
 {
     if ($isThumb) {
         if (!$path) {
             $path = $this->_defaultThumb;
         }
         $path = str_replace(JURI::base(), '', $path);
         $imagSource = JPATH_SITE . '/' . $path;
         $imagSource = urldecode($imagSource);
         if (file_exists($imagSource)) {
             $tmp = explode("/", $path);
             $imageName = $width . "x" . $height . "-" . $tmp[count($tmp) - 1];
             $thumbPath = $this->_thumbnailPath . $imageName;
             if (!file_exists($thumbPath)) {
                 //create thumb
                 BTImageHelper::createImage($imagSource, $thumbPath, $width, $height, true);
             }
             $path = $this->_thumbnaiURL . $imageName;
         }
     }
     //return path
     return $path;
 }
        } else {
            if (file_exists($originalPath . $photo->file)) {
                $originalFile = $originalPath . $photo->file;
            } else {
                if (isset($photo->remote)) {
                    $originalFile = $photo->remote;
                }
            }
        }
        if (file_exists($file)) {
            $imageSize = getimagesize($file);
            if ($imageSize[0] != $thumbWidth || $imageSize[1] != $thumbHeight) {
                BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, $params->get('jpeg_compression'));
            }
        } else {
            BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, $params->get('jpeg_compression'));
        }
    }
}
$caption = $params->get('caption', 0);
$showTitle = false;
$showDesc = false;
$showLink = false;
switch ($caption) {
    case '1':
        $showTitle = true;
        break;
    case '2':
        $showTitle = true;
        $showLink = true;
        break;
Example #4
0
 /**
  * Upload image
  */
 function upload()
 {
     $file = JRequest::getString('btfile');
     $file = str_replace(' ', '%20', $file);
     $source = JRequest::getString('source');
     $videoId = JRequest::getString('videoid');
     $fileInfo = pathinfo($file);
     $objFile = new stdClass();
     $hashedName = md5($this->moduleID . '-' . $source . '-' . $fileInfo['filename']);
     if ($videoId) {
         $hashedName = md5($this->moduleID . '-' . $source . '-' . $videoId);
     }
     $filename = $hashedName . '.' . $fileInfo["extension"];
     if (JFile::exists($this->saveDir . "/tmp/manager/{$filename}") || in_array($filename, $this->items)) {
         $this->result['message'] = JText::_('MOD_BTBGSLIDESHOW_FILE_EXISTED');
         $validated = false;
     } else {
         if (JRequest::getString('remote')) {
             BTImageHelper::resize($file, $this->saveDir . "/tmp/manager/{$filename}", 128, 96);
             $objFile->filename = $filename;
             $objFile->title = JRequest::getString('title') ? JRequest::getString('title') : '';
             $objFile->remote = $file;
             if ($videoId) {
                 $objFile->videoId = $videoId;
             }
             $validated = true;
         } else {
             //neu chua co file nay trong thu muc original thi load file do vao trong thu muc tmp
             if (!copy($file, "{$this->saveDir}/tmp/original/{$filename}")) {
                 $this->result['message'] = JText::_('MOD_BTBGSLIDESHOW_ERROR_COULD_NOT_SAVE');
                 $validated = false;
             } else {
                 BTImageHelper::resize($this->saveDir . "/tmp/original/{$filename}", $this->saveDir . "/tmp/manager/{$filename}", 128, 96);
                 $objFile->filename = $filename;
                 $objFile->title = JRequest::getString('title') ? JRequest::getString('title') : '';
                 if ($videoId) {
                     $objFile->videoId = $videoId;
                 }
                 $validated = true;
             }
         }
     }
     if ($validated) {
         $this->result['success'] = true;
         $this->result['files'] = $objFile;
     }
     return json_encode($this->result);
 }
Example #5
0
 function rebuild()
 {
     $building = JRequest::getVar('building');
     $session = JFactory::getSession();
     $db = JFactory::getDBO();
     if ($building) {
         $images = $session->get('rebuild-images');
         $output = $session->get('rebuild-output');
     } else {
         $db->setQuery('Select im.id,im.filename,im.title as image_title,im.item_id,pf.title,pf.params from #__bt_portfolio_images as im inner join #__bt_portfolios as pf on im.item_id = pf.id order by pf.title desc');
         $images = $db->loadObjectList();
         $output = '<h3>Rebuild thumbnail & large images of portfolios:</h3>';
         $output .= '<b>Total: ' . count($images) . ' images</b><hr />';
     }
     if (count($images)) {
         $image = array_pop($images);
         $session->set('rebuild-images', $images);
         $registry = new JRegistry();
         $registry->loadString($image->params);
         $this->overrideConfigs($registry);
         $path_image_thumb = $this->images_path . $image->item_id . '/thumb/';
         $path_image_ssthumb = $this->images_path . $image->item_id . '/ssthumb/';
         $path_image_large = $this->images_path . $image->item_id . '/large/';
         $path_image_orig = $this->images_path . $image->item_id . '/original/';
         if (!is_file($path_image_orig . $image->filename) && is_file($path_image_large . $image->filename)) {
             JFile::copy($path_image_large . $image->filename, $path_image_orig . $image->filename);
         }
         if (!is_file($path_image_orig . $image->filename)) {
             @unlink($path_image_large . $image->filename);
             @unlink($path_image_thumb . $image->filename);
             @unlink($path_image_ssthumb . $image->filename);
             $query = 'DELETE FROM #__bt_portfolio_images WHERE id =' . $image->id;
             $db->setQuery($query);
             $db->query();
             $output .= $image->title . ':<i> ' . $image->image_title . '</i><font style="color:red"> - Image not found! Removed!</font><br />';
         } else {
             $this->prepareFolders($image->item_id);
             if ($this->largeimgprocess != -1) {
                 BTImageHelper::resize($path_image_orig . $image->filename, $path_image_large . $image->filename, $this->crop_width, $this->crop_height, $this->largeimgprocess, $this->crop_pos, $this->jpeg_com);
             }
             if ($this->thumbimgprocess != -1) {
                 BTImageHelper::resize($path_image_orig . $image->filename, $path_image_thumb . $image->filename, $this->thumb_width, $this->thumb_height, $this->thumbimgprocess, $this->crop_pos, $this->jpeg_com);
             }
             BTImageHelper::resize($path_image_orig . $image->filename, $path_image_ssthumb . $image->filename, $this->ssthumb_width, $this->ssthumb_height, $this->thumbimgprocess, $this->crop_pos, $this->jpeg_com);
             $output .= '' . $image->title . ':<i> ' . $image->image_title . '</i><br />';
         }
         echo '<html><head><title>Rebuilding images...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta HTTP-EQUIV="REFRESH" content="0; url=index.php?option=com_bt_portfolio&task=portfolios.rebuild&tmpl=component&building=true;"></head>';
         echo '<body>' . $output . '...</body></html>';
         $session->set('rebuild-output', $output);
         exit;
     } else {
         return $output;
     }
 }
        fwrite($pt, json_encode($config));
        fclose($pt);
        $crop = true;
        $cropThumbnail = true;
    }
}
if ($cropImage) {
    foreach ($photos as $photo) {
        $originalFile = $originalPath . $photo->file;
        $file = $cropPath . $photo->file;
        if (!file_exists($file) || $crop) {
            BTImageHelper::resize($originalFile, $file, $cropWidth, $cropHeight, true, $imageQuality);
        }
    }
    $folder = $moduleURI . 'images/slideshow/';
} else {
    $folder = $moduleURI . 'images/original/';
}
if ($showPaginationThumbnail) {
    $thumbailPath = JPATH_BASE . '/modules/mod_bt_simple_slideshow/images/thumbnail/';
    $thumbnailLink = $moduleURI . 'images/thumbnail/';
    foreach ($photos as $photo) {
        $originalFile = $originalPath . $photo->file;
        $file = $thumbailPath . $photo->file;
        if (!file_exists($file) || $cropThumbnail) {
            BTImageHelper::resize($originalFile, $file, $thumbnailWidth, $thumbnailHeight, true, $imageQuality);
        }
    }
}
BtSimpleSlideshowHelper::fetchHead($params);
require JModuleHelper::getLayoutPath('mod_bt_simple_slideshow', 'default');
<?php

/**
 * @version		$Id: images.php 1 Aug 20, 2011 9:51:20 AM Thomas $
 * @package		BTShowcase
 * @copyright	Copyright (C) 2011 Bow Themes. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access
defined('_JEXEC') or die;
$items = json_decode(base64_decode($params->get('gallery')));
if (count($items) == 0) {
    echo JText::_('MOD_BTSLIDESWHO_NOTICE_NO_IMAGES');
    return;
}
$moduleID = $module->id;
// Clean images that haven't used
require_once JPATH_ROOT . '/modules/mod_btslideshow/helpers/files.php';
BTFilesHelper::cleanFiles($items, $moduleID);
// Make thumbnail & slideshow images if haven't created or just change the size
require_once JPATH_ROOT . '/modules/mod_btslideshow/helpers/images.php';
$dir = JPATH_ROOT . '/modules/mod_btslideshow/images/' . $moduleID;
foreach ($items as $item) {
    BTImageHelper::createImage("{$dir}/original/{$item->file}", "{$dir}/slideshow/{$item->file}", $params->get('width'), $params->get('height'), true, $params->get('jpeg-compression'));
    BTImageHelper::createImage("{$dir}/original/{$item->file}", "{$dir}/thumbnail/{$item->file}", $params->get('thumb-width'), $params->get('thumb-height'), true, $params->get('jpeg-compression'));
}
require JModuleHelper::getLayoutPath('mod_btslideshow', $params->get('layout', 'default'));
Example #8
0
 private function dailymotionGetVideo($video_id)
 {
     $hashedName = md5('dailymotion-' . strtotime("now") . $video_id);
     $filename = $hashedName . '.jpg';
     $pid = JRequest::getVar('id');
     $videoObj = NULL;
     $videoObj = new stdClass();
     $video_image = 'http://www.dailymotion.com/thumbnail/video/' . $video_id;
     $description = get_meta_tags("http://www.dailymotion.com/video/" . $video_id . '?fields=title');
     $urlFeed = simplexml_load_file("http://www.dailymotion.com/api/oembed?url=http://www.dailymotion.com/video/" . $video_id . "&format=xml");
     $title = $urlFeed->title;
     $desc = $description['description'];
     if ($urlFeed) {
         if (copy($video_image, $this->videoOriginalDir . '/' . $hashedName . '.jpg')) {
             if (copy($video_image, $this->videothumbDir . '/' . $hashedName . '.jpg')) {
                 if (file_exists($this->videothumbDir . '/' . $hashedName . '.jpg')) {
                     BTImageHelper::resize($this->videoOriginalDir . "/{$filename}", $this->videothumbDir . "/{$filename}", $this->params->get('thumb_width', 336), $this->params->get('thumb_height', 180), $this->params->get('thumbimgprocess', 1), $this->params->get('crop-position', 'c'), $this->params->get('jpeg-compression', 100));
                 }
             }
             if (copy($video_image, $this->videolargeDir . '/' . $hashedName . '.jpg')) {
                 if (file_exists($this->videolargeDir . '/' . $hashedName . '.jpg')) {
                     BTImageHelper::resize($this->videoOriginalDir . "/{$filename}", $this->videolargeDir . "/{$filename}", $this->params->get('crop_width', 600), $this->params->get('crop_height', 400), $this->params->get('thumbimgprocess', 1), $this->params->get('crop-position', 'c'), $this->params->get('jpeg-compression', 100));
                 }
             }
             if (copy($video_image, $this->videossthumbDir . '/' . $hashedName . '.jpg')) {
                 if (file_exists($this->videossthumbDir . '/' . $hashedName . '.jpg')) {
                     BTImageHelper::resize($this->videoOriginalDir . "/{$filename}", $this->videossthumbDir . "/{$filename}", $this->params->get('ss_thumb_width', 70), $this->params->get('ss_thumb_height', 40), $this->params->get('thumbimgprocess', 1), $this->params->get('crop-position', 'c'), $this->params->get('jpeg-compression', 100));
                 }
             }
             $videoObj->name = (string) $title;
             $videoObj->description = (string) $desc;
             $videoObj->id_video = $video_id;
             $videoObj->thumb_video = $filename;
             $videoObj->source_video = 'dailymotion Server';
             $videoObj->video_type = 'video';
             $this->sessionStore('video_dailymotion', $videoObj, $this->videodailymotion);
             $rs_html = $this->createHTML($hashedName, $videoObj->thumb_video, $videoObj->name, 'video_dailymotion');
             $this->result['success'] = TRUE;
             $this->result['title'] = (string) $title;
             $this->result['description'] = (string) $desc;
             $this->result['embed'] = (string) ('<iframe frameborder="0" src="http://www.dailymotion.com/embed/video/' . trim($video_id) . '?autoplay=1&logo=0&info=0"></iframe>');
             $this->result['message'] = JText::_('Video has been get successfully!');
             $this->result['data'] = $rs_html;
             $this->result['url'] = 'http://www.dailymotion.com/video/' . $video_id;
         } else {
             $this->result['message'] = JText::_('Video not found');
         }
     } else {
         $this->result['message'] = JText::_('This video not found.');
     }
     return json_encode($this->result);
 }
Example #9
0
 /**
  * Handle uploadify ajax request
  */
 function html5upload()
 {
     $validated = true;
     $file = $_FILES['bt_images']['tmp_name'];
     $objFile = new stdClass();
     $extension = explode('.', $_FILES['bt_images']['name']);
     $extension = strtolower($extension[count($extension) - 1]);
     if (in_array($extension, $this->allowedExtensions)) {
         $hashedName = md5($this->moduleID . '-' . 'upload-' . substr($_FILES['bt_images']['name'], 0, strrpos($_FILES['bt_images']['name'], '.')));
         $filename = "{$hashedName}.{$extension}";
         if (!JFile::exists($this->saveDir . "/tmp/manager/{$filename}") && !in_array($filename, $this->items)) {
             if (!JFile::upload($file, "{$this->saveDir}/tmp/original/{$filename}")) {
                 $this->result['message'] = JText::_('ERROR_COULD_NOT_SAVE');
                 $validated = false;
             } else {
                 BTImageHelper::resize($this->saveDir . "/tmp/original/{$filename}", $this->saveDir . "/tmp/manager/{$filename}", 128, 96);
                 $objFile->filename = $filename;
                 $objFile->title = $filename;
             }
         } else {
             $this->result['message'] = JText::_('FILE_EXISTED');
             $validated = false;
         }
     } else {
         $this->result['message'] = JText::_('FILE_EXTENSION_INVALID');
         $validated = false;
     }
     if ($validated) {
         $this->result['success'] = true;
         $this->result['files'] = $objFile;
     }
     return json_encode($this->result);
 }
Example #10
0
     $hashedName = md5($moduleID . '-' . $photo1->source . '-' . $fileInfo['filename']);
     if (!JFile::exists($saveDir . "/manager/{$hashedName}.{$fileInfo["extension"]}")) {
         $addedPhotos[] = $photo1;
     }
 }
 if ($params->get('get_limit')) {
     $addedPhotos = array_slice($addedPhotos, 0, $params->get('get_limit'));
 }
 $addedObjPhotos = array();
 foreach ($addedPhotos as $photo2) {
     $fileInfo = $photo2->pathInfo;
     $hashedName = md5($moduleID . '-' . $photo2->source . '-' . $fileInfo['filename']);
     $filename = "{$hashedName}.{$fileInfo["extension"]}";
     $objFile = new stdClass();
     if (copy($photo2->file, "{$saveDir}/original/{$filename}")) {
         BTImageHelper::resize($saveDir . "/original/{$filename}", $saveDir . "/manager/{$filename}", 128, 96);
         $objPhoto = new stdClass();
         $objPhoto->file = $filename;
         $objPhoto->remote = $remote ? $photo2->file : '';
         $objPhoto->title = $photo2->title;
         $addedObjPhotos[] = $objPhoto;
     }
 }
 $photos = array_merge($photos, $addedObjPhotos);
 if ($syncType == 'sync') {
     // get photo existed
     $photoExisted = array();
     if (is_dir($managerPath)) {
         $open = opendir($managerPath);
         $arrFiles = array();
         $filename = readdir($open);
Example #11
0
    protected function _build($moduleID, $name, $value)
    {
        /* @var JDocument $document */
        $document = JFactory::getDocument();
        if (version_compare(JVERSION, '1.6.0', 'ge')) {
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btslideshow.min.js");
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btbase64.min.js");
            $document->addScriptDeclaration('(function($){$(document).ready(function(){initGallery();});})(jQuery);');
        } else {
            $document->addScript(JURI::root() . "modules/mod_bt_apb/assets/js/btloader.min.js");
            // Hack, replace mootools by newer
            foreach ($document->_scripts as $key => $tmp) {
                if (preg_match('#media/system/js/mootools.js#is', $key)) {
                    unset($document->_scripts[$key]);
                }
            }
            $mootools = array(JURI::root() . "modules/mod_bt_apb/assets/js/mootools-core.js" => 'text/javascript', JURI::root() . "modules/mod_bt_apb/assets/js/mootools-more.js" => 'text/javascript');
            $document->_scripts = $mootools + $document->_scripts;
            ?>
            <script>

                (function(){
                    var libs = [
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/mootools-core.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/mootools-more.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/btslideshow.min.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/js/btbase64.min.js',
                        '<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/squeezebox/squeezebox.min.js'
                    ];

                    BT.Loader.js(libs, function(){
                        initGallery();
                    });
                    BT.Loader.css('<?php 
            echo JURI::root();
            ?>
modules/mod_bt_apb/assets/squeezebox/assets/squeezebox.css');

                    window.addEvent('load', function() {
                        document.combobox = null;
                        var combobox = new JCombobox();
                        document.combobox = combobox;
                    });

                })();
            </script>
            <?php 
        }
        // Remove temp files
        $images = json_decode(base64_decode($value));
        //check if 0 folder exists
        $saveDir = JPATH_SITE . '/modules/mod_bt_apb/images';
        if ($moduleID != 0 && JFolder::exists($saveDir . '/0')) {
            JFolder::move($saveDir . '/0', $saveDir . '/' . $moduleID);
        }
        //load file if miss save
        $originalDir = $saveDir . '/' . $moduleID . '/original';
        if (is_dir($originalDir)) {
            $open = opendir($originalDir);
            $arrFiles = array();
            $filename = readdir($open);
            while ($filename !== false) {
                //check validated file
                if (filetype($originalDir . '/' . $filename) == "file") {
                    $existed = false;
                    if (count($images) > 0) {
                        foreach ($images as $image) {
                            if ($image->file == $filename) {
                                $existed = true;
                                break;
                            }
                        }
                    }
                    if (!$existed) {
                        $objFile = new stdClass();
                        $objFile->file = $filename;
                        $objFile->title = '';
                        $images[] = $objFile;
                    }
                }
                $filename = readdir($open);
            }
        }
        $moduleURI = JPATH_SITE . "/modules/mod_bt_apb/";
        if (isset($this->params)) {
            $thumbWidth = $this->params->thumbnail_width;
            $thumbHeight = $this->params->thumbnail_height;
            // Make thumbnail if haven't created or just change the size
            $originalPath = JPATH_SITE . '/modules/mod_bt_apb/images/original/';
            $thumbnailPath = JPATH_SITE . '/modules/mod_bt_apb/images/thumbnail/';
            $originalFile = '';
            foreach ($images as $image) {
                $file = $thumbnailPath . $image->file;
                if ($this->params->remote_image) {
                    if (isset($image->remote)) {
                        $originalFile = $image->remote;
                    } else {
                        $originalFile = $originalPath . $image->file;
                    }
                } else {
                    if (file_exists($originalPath . $image->file)) {
                        $originalFile = $originalPath . $image->file;
                    } else {
                        if (isset($image->remote)) {
                            $originalFile = $image->remote;
                        }
                    }
                }
                if (file_exists($file)) {
                    $imageSize = getimagesize($file);
                    if ($imageSize[0] != $thumbWidth || $imageSize[1] != $thumbHeight) {
                        BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, 100);
                    }
                } else {
                    BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight, true, 100);
                }
            }
        }
        $value = base64_encode(json_encode($images));
        $html = '
			<div id="btss-message" class="clearfix"></div>
                  <ul id="btss-upload-list"></ul>
			<div id="btss-file-uploader">
				<noscript>
					<p>' . JText::_('MOD_BTBGSLIDESHOW_NOTICE_JAVASCRIPT') . '</p>
				</noscript>
			</div>
			<input id="btss-gallery-hidden" class="gallery-option" type="hidden" name="' . $name . '" value="" />
			<ul id="btss-gallery-container" class="clearfix"></ul>
			';
        ?>
        <script type="text/javascript">
            function openFrame(a){
                var jQ = jQuery.noConflict();				
                if(jQ("#ifK2Articles").css('display') != 'none') return false;
                if(jQ(a).attr('rel') == 0){
                    jQ(a).html('Back');
                    jQ(a).attr('rel', 1);
                    jQ("#sbox-window .adminform").hide();
                    jQ("#sbox-window").animate({height: 450}, 300);
                    jQ("#ifArticles").show();
                }else{
                    jQ(a).html('Select Article');
                    jQ(a).attr('rel', 0);
                    jQ("#sbox-window .adminform").show();
                    jQ("#sbox-window").animate({height: 380}, 300);
                    jQ("#ifArticles").hide();
                }
                return false;
            }

            function jSelectArticle_jform_params_id(id, title, order){
                var jQ = jQuery.noConflict();				
                jQ("#btss-article").html('Select Article');
                jQ("#btss-article").attr('rel', 0);
                jQ("#ifArticles").hide();
                jQ("#sbox-window").animate({height: 380}, 300);
                jQ("#sbox-window .adminform").show();
                jQ.ajax({
                    type: "post",
                    url: location.href,
                    data: {action: "get_article",article_id : id},
                    success: function(response){
                        var data = jQ.parseJSON(response);						
                        if(data!= null && data.success){
                            jQ("#sbox-window .btss-title").val(title);
                            jQ("#sbox-window .btss-link").val(data.link);
                            jQ("#sbox-window .btss-desc").val(data.desc);							
                        }else{
                            jQ("#sbox-window .adminform").prepend(
                            "<div style='color: red; font-size: 10px;'>Importing article is failed. Have some errors.</div>"
                        );
                        }
                    },
                    error: function(jqXHR, textStatus, errorThrown){
                        //alert('Sending ajax request is failed. Check ajax.php, please.')
                    }
                });
            }
        <?php 
        require_once JPATH_ROOT . '/modules/mod_bt_apb/helpers/helper.php';
        if (BtApbHelper::checkK2Component()) {
            ?>
                    function openK2Frame(a){
                        var jQ = jQuery.noConflict();
                        if(jQ("#ifArticles").css('display') != 'none') return false;
                        if(jQ(a).attr('rel') == 0){
                            jQ(a).html('Back');
                            jQ(a).attr('rel', 1);
                            jQ("#sbox-window .adminform").hide();
                            jQ("#sbox-window").animate({height: 450}, 300);
                            jQ("#ifK2Articles").show();
                        }else{
                            jQ(a).html('Select K2 Article');
                            jQ(a).attr('rel', 0);
                            jQ("#sbox-window .adminform").show();
                            jQ("#sbox-window").animate({height: 380}, 300);
                            jQ("#ifK2Articles").hide();
                        }
                        return false;
                    }
                    function jSelectItem(id, title, objectname){
                        var jQ = jQuery.noConflict();
                        jQ("#btss-k2article").html('Select K2 Article');
                        jQ("#btss-k2article").attr('rel', 0);
                        jQ("#ifK2Articles").hide();
                        jQ("#sbox-window").animate({height: 350}, 300);
                        jQ("#sbox-window .adminform").show();
                        jQ.ajax({
                            type: "post",
                            url: location.href,
                            data: {action: "get_article", article_id : id, k2 : 1},
                            success: function(response){
                                var data = jQ.parseJSON(response);
                                if(data!= null && data.success){
                                    jQ("#sbox-window .btss-title").val(title);									
                                    jQ("#sbox-window .btss-link").val(data.link);									
                                    jQ("#sbox-window .btss-desc").val(data.desc);
                                }else{
                                    jQ("#sbox-window .adminform").prepend(
                                    "<div style='color: red; font-size: 10px;'>Importing k2 article is failed. Have some errors.</div>"
                                );
                                }
                            },
                            error: function(jqXHR, textStatus, errorThrown){
                                //alert('Sending ajax request is failed. Check ajax.php, please.')
                            }
                        });
                    }
            <?php 
        }
        ?>
	
			function initGallery(){
                BTSlideshow = new BT.Slideshow({
                    liveUrl: '<?php 
        echo JURI::root();
        ?>
',
                    encodedItems: '<?php 
        echo $value;
        ?>
',
                    moduleID: '<?php 
        echo $moduleID;
        ?>
',
                    galleryContainer: 'btss-gallery-container',
                    dialogTemplate:
                        '<div style="margin: 10px 0px 10px 10px;" class="button2-left">'+
                        '     <div class="blank">'+
                        '         <a id="btss-article" onclick="openFrame(this);" title="Import from article" class="btn btn-small" rel="0">Select Article</a>' +
                        '     </div>'+
                        '</div>'+
        <?php 
        if (BtApbHelper::checkK2Component()) {
            ?>
                            '<div style="margin: 10px 0px 10px 10px;" class="button2-left">'+
                                '     <div class="blank">'+
                                '         <a id="btss-k2article" onclick="openK2Frame(this);" title="Import from K2 article" class="btn btn-small" rel="0">Select K2 Article</a>' +
                                '     </div>'+
                                '</div>'+
            <?php 
        }
        ?>
                    '<fieldset style="clear: both;" class="adminform">' +
						'<legend><?php 
        echo JText::_('CAPTION');
        ?>
</legend>'+
                        '<ul class="adminformlist">' +
                        '<li>' +
                        '<label class="btss-title-lbl" class="hasTip" title="<?php 
        echo JText::_('TITLE_DESC');
        ?>
" for="btss-title"><?php 
        echo JText::_('TITLE_LABEL');
        ?>
</label>' +
                        '<input class="btss-title" type="text" name="btss-title" size="90" />' +
                        '</li>' +
                        '<li>' +
                        '<label class="btss-link-lbl" class="hasTip" title="<?php 
        echo JText::_('LINK_DESC');
        ?>
" for="btss-link"><?php 
        echo JText::_('LINK_LABEL');
        ?>
</label>' +
                        '<input class="btss-link" type="text" name="btss-link" size="90" />' +
                        '</li>' +
                        '<li>' +
                        '<label class="btss-target-lbl" class="hasTip" title="<?php 
        echo JText::_('TARGET_DESC');
        ?>
" for="btss-target"><?php 
        echo JText::_('TARGET_LABEL');
        ?>
</label>' +
                        '<select class="btss-target" name="btss-link">' +
                        '   <option value=""><?php 
        echo JText::_('TARGET_CURRENT');
        ?>
</option>' +
                        '   <option value="_blank"><?php 
        echo JText::_('TARGET_BLANK');
        ?>
</option>' +
                        '   <option value="window"><?php 
        echo JText::_('TARGET_WINDOW');
        ?>
</option>' +
                        '</select>'+
                        '</li>' +						
                        '<li>' +
                        '<label class="btss-desc-lbl" class="hasTip" title="<?php 
        echo JText::_('DESCRIPTION_DESC');
        ?>
" for="btss-desc"><?php 
        echo JText::_('DESCRIPTION_LABEL');
        ?>
</label>' +
                        '<textarea style="width: 375px;" class="btss-desc" name="btss-desc" rows="5" cols="50"></textarea>' +
                        '</li>' +
                        '</ul>' +                      
                        '</fieldset>' +						
						'<div style="clear: both;">' +
                        '<label>&nbsp;</label><button class="btss-dialog-ok btn btn-small" style="margin-left: 10px;"><?php 
        echo JText::_('BTN_OK');
        ?>
</button><button class="btss-dialog-cancel btn btn-small" style="margin-left: 10px;"><?php 
        echo JText::_('BTN_CANCEL');
        ?>
</button>'+
                        '</div>' +
                        '<iframe style="display: none" id="ifArticles" height="400" frameborder="0" width="775" src="index.php?option=com_content&view=articles&layout=modal&tmpl=component&function=jSelectArticle_jform_params_id"></iframe>'+
                        '<iframe style="display: none" id="ifK2Articles" height="400" frameborder="0" width="775" src="index.php?option=com_k2&view=images&task=element&tmpl=component"></iframe>'
                });


           };

        </script>
        <?php 
        return $html;
    }
Example #12
0
            if (isset($photo->remote)) {
                $originalFile = $photo->remote;
            } else {
                $originalFile = $originalPath . $photo->file;
            }
        } else {
            if (file_exists($originalPath . $photo->file)) {
                $originalFile = $originalPath . $photo->file;
            } else {
                if (isset($photo->remote)) {
                    $originalFile = $photo->remote;
                }
            }
        }
        if (file_exists($file)) {
            $imageSize = getimagesize($file);
            if ($imageSize[0] != $thumbWidth || $imageSize[1] != $thumbHeight) {
                BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight);
            }
        } else {
            BTImageHelper::resize($originalFile, $file, $thumbWidth, $thumbHeight);
        }
    }
    $photosList = array_chunk($photos, $itemPerLi);
}
$liWidth = floor($thumbWidth * 0.7);
$liWidth = floor($thumbHeight * 0.7);
BTImageGalleryHelper::fetchHead($params);
$language = JFactory::getLanguage();
$rtl = $language->isRTL();
require JModuleHelper::getLayoutPath('mod_btimagegallery', 'default');