static function getItemsAutoloadfolder(&$params) { self::$slideshowparams = $params; $authorisedExt = array('png', 'jpg', 'JPG', 'JPEG', 'jpeg', 'bmp', 'tiff', 'gif'); $items = JFolder::files(trim($params->get('autoloadfoldername'), '/'), '.jpg|.png|.jpeg|.gif|.JPG|.JPEG|.jpeg', false, true); foreach ($items as $i => $name) { $item = new stdClass(); // $item->imgname = str_replace(JUri::base(),'', $item->imgname); $item->imgthumb = ''; $item->imgname = trim(str_replace('\\', '/', $name), '/'); $item->imgname = trim($item->imgname, '\\'); // create new images for mobile if ($params->get('usemobileimage', '0')) { self::resizeImage($item->imgname, $params->get('mobileimageresolution', '640'), '', $params->get('mobileimageresolution', '640'), ''); } if ($params->get('thumbnails', '1') == '1') { $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '100'), $params->get('thumbnailheight', '75')); } $thumbext = explode(".", $item->imgname); $thumbext = end($thumbext); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = null; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; if (!in_array(strToLower(JFile::getExt($item->imgname)), $authorisedExt)) { continue; } // load the image data from txt $item = self::getImageDataFromfolder($item, $params); $item->imgname = JURI::base(true) . '/' . $item->imgname; $items[$i] = $item; // route the url if (strcasecmp(substr($item->imglink, 0, 4), 'http') && strpos($item->imglink, 'index.php?') !== false) { $item->imglink = JRoute::_($item->imglink, true, false); } else { $item->imglink = JRoute::_($item->imglink); } } return $items; }
/** * Get a list of the items. * * @param JRegistry $params The module options. * * @return array */ static function getItemsAutoloadflickr(&$params) { self::$slideshowparams = $params; $url = 'https://api.flickr.com/services/rest/?format=json&method=flickr.photosets.getPhotos&extras=description,original_format,url_sq,url_t,url_s,url_m,url_o&nojsoncallback=1'; $url .= '&api_key=' . $params->get('flickr_apikey'); $url .= '&photoset_id=' . $params->get('flickr_photoset'); if (function_exists('file_get_contents')) { $result = @file_get_contents($url); } // look for curl if ($result == '' && extension_loaded('curl')) { $ch = curl_init(); $timeout = 30; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $result = curl_exec($ch); curl_close($ch); } $images = json_decode($result)->photoset->photo; $items = array(); $i = 0; foreach ($images as &$image) { $items[$i] = new stdClass(); $item = $items[$i]; $item->imgname = $image->url_o; $item->imgthumb = $item->imgname; // create new images for mobile // if ($params->get('usemobileimage', '0')) { // self::resizeImage($item->imgname, $params->get('mobileimageresolution', '640'), '', $params->get('mobileimageresolution', '640'), ''); // } // if ($params->get('thumbnails', '1') == '1') // $item->imgthumb = JURI::base(true) . '/' . self::resizeImage($item->imgname, $params->get('thumbnailwidth', '100'), $params->get('thumbnailheight', '75')); // $thumbext = explode(".", $item->imgname); // $thumbext = end($thumbext); // set the variables $item->imgvideo = null; $item->slideselect = null; $item->slideselect = null; $item->imgcaption = null; $item->article = null; $item->slidearticleid = null; $item->imgalignment = null; $item->imgtarget = 'default'; $item->imgtime = null; $item->imglink = null; $item->imgtitle = null; // show the title and description of the image if ($params->get('flickr_showcaption', '1')) { $item->imgtitle = $image->title; $item->imgcaption = $image->description->_content; } // set the link to the image if ($params->get('flickr_autolink', '0')) { $item->imglink = $image->url_o; } $i++; } return $items; }