function ag_imageInfo($imageURLPHP) { list($width, $height, $type, $attr) = getimagesize($imageURLPHP); $types = array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF(intel byte order)', 8 => 'TIFF(motorola byte order)', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM'); if ($type) { return $imageInfo = array("width" => $width, "height" => $height, "type" => $types[$type], "size" => agHelper::ag_fileRoundSize(filesize($imageURLPHP))); } }
foreach ($ag_files as $key => $value) { if (is_numeric(array_search(strtolower(JFile::getExt(basename($value))), $ag_ext_valid))) { $ag_images[] = $value; } } if (array_search($ag_fileName, $ag_images) != 0) { $ag_fileName_prev = $ag_images[array_search($ag_fileName, $ag_images) - 1]; } if (array_search($ag_fileName, $ag_images) < count($ag_images) - 1) { $ag_fileName_next = $ag_images[array_search($ag_fileName, $ag_images) + 1]; } if (!empty($ag_fileName_prev)) { $ag_preview_content .= '<a class="AG_common_button" href="" onclick="AG_jQuery(\'#AG_input_itemURL\').val(\'' . $ag_folderName . '/' . $ag_fileName_prev . '\');submitbutton(\'AG_reset\');return false;"><span><span>' . JText::_("AG_PREVIOUS_IMAGE") . '</span></span></a>' . "\n"; } if (!empty($ag_fileName_next)) { $ag_preview_content .= '<a class="AG_common_button" href="" onclick="AG_jQuery(\'#AG_input_itemURL\').val(\'' . $ag_folderName . '/' . $ag_fileName_next . '\');submitbutton(\'AG_reset\');return false;"><span><span>' . JText::_("AG_NEXT_IMAGE") . '</span></span></a>' . "\n"; } } $ag_preview_content .= '<hr />'; $ag_preview_content .= ' <h1>' . JText::_('AG_IMAGE_DETAILS_FOR_FILE') . '</h1> <div class="AG_border_color AG_border_width AG_margin_bottom AG_breadcrumbs_wrapper"> ' . $this->ag_render_breadcrumb($ag_itemURL, $this->ag_starting_folder, $ag_folderName, $ag_fileName) . ' </div> '; agHelper::ag_createThumb(JPATH_SITE . $ag_itemURL, $thumbsFolderPhysicalPath . DIRECTORY_SEPARATOR . basename($ag_itemURL), 145, 80, "none"); //Image and image details $ag_preview_content .= $this->ag_render_image_info($ag_itemURL, $AG_imgInfo, $ag_hasXML, $ag_hasThumb); require_once JPATH_ROOT . DIRECTORY_SEPARATOR . 'administrator' . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_admirorgallery' . DIRECTORY_SEPARATOR . 'slimbox' . DIRECTORY_SEPARATOR . 'index.php'; $ag_preview_content .= $this->ag_render_captions($ag_imgXML_captions); $ag_preview_content .= $this->ag_render_file_footer();
$imageInfo_array = agHelper::ag_imageInfo(JPATH_BASE . DS . $ag->params['rootFolder'] . $ag->imagesFolderName . '/' . $imageValue); $html .= ' <table border="0" cellspacing="0" cellpadding="0" width="100%" class="ag_overscroll_item"> <tbody> <tr><td class="ag_overscroll_thumbTd"> <span class="ag_thumb' . $ag->params['galleryStyle'] . '">'; $html .= $ag->generatePopupHTML($popup, $imageValue); $html .= '</span></td><td class="ag_overscroll_info"> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr><td class="ag_overscroll_description"> ' . $ag->getDescription($imageValue) . ' <tr><td class="ag_overscroll_imageStat"> <span>W:' . $imageInfo_array["width"] . 'px</span> <span>H:' . $imageInfo_array["height"] . 'px</span> <span>S:' . agHelper::ag_fileRoundSize($imageInfo_array['size']) . '</span> </td></tr> </td></tr></tbody></table> </td></tr></tbody></table>'; } $html .= ' </div> </div> </div> '; $html .= ' <script type="text/javascript"> jQuery(function($) { jQuery(".ag_overscroll_bodyHolder").overscroll(); });
function loadImageFiles() { $this->images = agHelper::ag_imageArrayFromFolder($this->imagesFolderPath, $this->params['sortImages']); }
<?php $ag_itemURL = $ag_init_itemURL; $ag_folderName = dirname($ag_itemURL); $ag_fileName = basename($ag_itemURL); $ag_hasXML = ""; $ag_hasThumb = ""; // Set Possible Description File Apsolute Path // Instant patch for upper and lower case... $ag_pathWithStripExt = JPATH_SITE . $ag_folderName . '/' . JFile::stripExt(basename($ag_itemURL)); $ag_imgXML_path = $ag_pathWithStripExt . ".XML"; if (JFIle::exists($ag_pathWithStripExt . ".xml")) { $ag_imgXML_path = $ag_pathWithStripExt . ".xml"; } include_once dirname(__FILE__) . '/agHelper.php'; $tempInfo = agHelper::ag_imageInfo(JPATH_SITE . $ag_itemURL); $ag_file_width = $tempInfo["width"] . 'px'; $ag_file_height = $tempInfo["height"] . 'px'; $ag_file_type = $tempInfo["type"]; $ag_file_size = $tempInfo["size"]; if (file_exists(JPATH_SITE . "/plugins/content/AdmirorGallery/thumbs/" . basename($ag_folderName) . "/" . basename($ag_fileName))) { $ag_hasThumb = '<img src="' . JURI::base() . 'components/com_admirorgallery/images/icon-hasThumb.png" class="ag_hasThumb" />'; } if (file_exists($ag_imgXML_path)) { $ag_hasXML = '<img src="' . JURI::base() . 'components/com_admirorgallery/images/icon-hasXML.png" class="ag_hasXML" />'; $ag_imgXML_xml =& JFactory::getXMLParser('simple'); $ag_imgXML_xml->loadFile($ag_imgXML_path); $ag_imgXML_captions =& $ag_imgXML_xml->document->captions[0]; } $ag_preview_content = ''; $ag_preview_content .= ' <div class="ag_screenSection_title">
$ag_hasXML = '<img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_templateID . '/images/icon-hasXML.png" class="ag_hasXML" />'; $ag_XML_xml =& JFactory::getXMLParser('simple'); $ag_XML_xml = simplexml_load_file($ag_XML_path); if (isset($ag_XML_xml->priority)) { $ag_XML_priority = $ag_XML_xml->priority; } if (isset($ag_XML_xml->visible)) { if ((string) $ag_XML_xml->visible == "false") { $ag_XML_visible = "HIDDEN"; } } } if (file_exists(JPATH_SITE . "/plugins/content/AdmirorGallery/thumbs/" . basename($ag_folderName) . "/" . basename($value))) { $ag_hasThumb = '<img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_templateID . '/images/icon-hasThumb.png" class="ag_hasThumb" />'; } agHelper::ag_createThumb(JPATH_SITE . $ag_itemURL . $value, $thumbsFolderPhysicalPath . DS . $value, 145, 80, "none"); $AG_thumb_checked = ""; if ($ag_XML_thumb == $value) { $AG_thumb_checked = " CHECKED"; } $ag_preview_content .= ' <div class="AG_border_color AG_border_width AG_item_wrapper"> <a href="' . $ag_itemURL . $value . '" class="AG_fileLink AG_item_link" title="' . $value . '"> <div style="display:block; text-align:center;" class="AG_item_img_wrapper"> <img src="' . JURI::root() . 'administrator/components/com_admirorgallery/assets/thumbs/' . $value . '" class="ag_imgThumb" /> </div> </a> <div class="AG_border_color AG_border_width AG_item_controls_wrapper"> <input type="text" value="' . JFile::stripExt(basename($value)) . '" name="AG_rename[' . $ag_itemURL . $value . ']" class="AG_input" style="width:95%" /><hr /> ' . JText::_($ag_XML_visible) . '<hr /> <img src="' . JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $AG_templateID . '/images/operations.png" style="float:left;" /><input type="checkbox" value="' . $ag_itemURL . $value . '" name="AG_cbox_selectItem[]" class="AG_cbox_selectItem"><hr />
/** * Read's all images from folder * @param <string> $targetFolder * @param <string> $arrange * @return <array> Sorted array of pictures */ public static function ag_imageArrayFromFolder($targetFolder) { $images = array(); if (!agHelper::ag_exists($targetFolder)) { return null; } $dh = opendir($targetFolder); if ($dh) { $ag_ext_valid = array("jpg", "jpeg", "gif", "png"); // SET VALID IMAGE EXTENSION while (($f = readdir($dh)) !== false) { if (is_numeric(array_search(strtolower(agHelper::ag_getExtension(basename($f))), $ag_ext_valid))) { $images[] = $f; } } } closedir($dh); return $images; }
<?php $ag->addCSS('/plugins/content/AdmirorGallery/templates/' . $ag->params['galleryStyle'] . '/template.css'); // Form HTML code $html = '<!-- ======================= Admiror Gallery --> <div id="AdmirorGallery' . $galleryCount . '(' . $ag->params['galleryStyle'] . '' . $articleID . ')"> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tbody> <tr> <td class="agArtistic_galleryHolder"> '; foreach ($ag->images as $imagesKey => $imageValue) { // Calculate $listed_imageSize $agArtistic_imageInfo_array = agHelper::ag_imageInfo(JPATH_BASE . DS . $ag->params['rootFolder'] . $ag->imagesFolderName . '/' . $imageValue); $html .= '<span class="ag_thumb' . $ag->params['galleryStyle'] . '">'; $html .= $ag->generatePopupHTML($popup, $imageValue); $html .= '<span class="agArtistic_description">' . $ag->getDescription($imageValue) . '</span>'; $html .= '<span class="agArtistic_size">' . agHelper::ag_fileRoundSize($agArtistic_imageInfo_array['size']) . '</span>'; $html .= '</span>'; } $html .= ' </td> </tr> </tbody> </table> '; $html .= '</div>'; //if there is any extra script that needs to be put after gallery html. $html .= $popup->jsInclude;
/** * Generates Album Thumbs */ function Album_generateThumb($AG_parent_folder, $AG_img) { if ($this->params['thumbWidth'] == 0 || $this->params['thumbHeight'] == 0) { $this->adderror(JText::_("AG_CANNOT_CREATE_THUMBNAILS_WIDTH_AND_HEIGHT_MUST_BE_GREATER_THEN_0")); return; } $imagesFolderPhysicalPath = $this->imagesFolderPhysicalPath . $AG_parent_folder . $this->DS; $thumbsFolderPhysicalPath = $this->thumbsFolderPhysicalPath . $AG_parent_folder . $this->DS; //Create directory in thumbs for gallery if (!file_exists($thumbsFolderPhysicalPath)) { JFolder::create($thumbsFolderPhysicalPath, 0755); } //Add's index.html to thumbs folder if (!file_exists($thumbsFolderPhysicalPath . 'index.html')) { $this->ag_indexWrite($thumbsFolderPhysicalPath . 'index.html'); } $original_file = $imagesFolderPhysicalPath . $AG_img; $thumb_file = $thumbsFolderPhysicalPath . $AG_img; if (!file_exists($thumb_file)) { $this->addError(agHelper::ag_createThumb($original_file, $thumb_file, $this->params['thumbWidth'], $this->params['thumbHeight'], $this->params['thumbAutoSize'])); } else { list($imagewidth, $imageheight) = getimagesize($thumb_file); switch ($this->params['thumbAutoSize']) { case "none": if ($imageheight != $this->params['thumbHeight'] || $imagewidth != $this->params['thumbWidth']) { $this->addError(agHelper::ag_createThumb($original_file, $thumb_file, $this->params['thumbWidth'], $this->params['thumbHeight'], $this->params['thumbAutoSize'])); } break; case "height": if ($imagewidth != $this->params['thumbWidth']) { $this->addError(agHelper::ag_createThumb($original_file, $thumb_file, $this->params['thumbWidth'], $this->params['thumbHeight'], $this->params['thumbAutoSize'])); } break; case "width": if ($imageheight != $this->params['thumbHeight']) { $this->addError(agHelper::ag_createThumb($original_file, $thumb_file, $this->params['thumbWidth'], $this->params['thumbHeight'], $this->params['thumbAutoSize'])); } break; } } // ERROR - Invalid image if (!file_exists($thumb_file)) { //$this->addError("Cannot read thumbnail"); $this->addError(JText::sprintf("AG_CANNOT_READ_THUMBNAIL", $thumb_file)); } }
<table border="0" cellspacing="0" cellpadding="0"><tbody><tr> <td><img src="<?php echo JURI::root() . 'administrator/components/com_admirorgallery/templates/' . $this->ag_template_id . '/images/bookmarkRemove.png'; ?> " style="float:left;" /></td> <td><input type="checkbox" value="<?php echo $value; ?> " name="AG_cbox_bookmarkRemove[]"></td> <td><span class="AG_border_color AG_border_width AG_separator"> </span></td> <td> <a href="' . $value . '" class="AG_folderLink AG_common_button" title="' . $value . '"> <span><span> <?php echo agHelper::ag_shrinkString(basename($value), 20, '...'); ?> </span></span> </a> </td> </tr></tbody></table> <?php } } ?> <div style="clear:both" class="AG_margin_bottom"></div> <hr /> <div class="AG_legend"> <h2><?php echo JText::_('AG_LEGEND');
$ag_pathWithStripExt = $AG->imagesFolderPhysicalPath . $folderName; $ag_XML_path = $ag_pathWithStripExt . ".XML"; if (file_exists($ag_pathWithStripExt . ".xml")) { $ag_XML_path = $ag_pathWithStripExt . ".xml"; } if (file_exists($ag_XML_path)) { // Check is descriptions file exists $ag_XML_xml = simplexml_load_file($ag_XML_path); if (isset($ag_XML_xml->thumb)) { $thumb_file = (string) $ag_XML_xml->thumb; } } if (empty($thumb_file)) { $images = agHelper::ag_imageArrayFromFolder($AG->imagesFolderPhysicalPath . $folderName); if (!empty($images)) { $images = agHelper::array_sorting($images, $AG->imagesFolderPhysicalPath . $folderName . DIRECTORY_SEPARATOR, $AG->params['arrange']); $thumb_file = $images[0]; // Get First image in folder as thumb } } if (!empty($thumb_file)) { $AG->Album_generateThumb($folderName, $thumb_file); } $html .= '<span class="ag_thumbclassic_centered"> <a href="#" onClick="AG_form_submit_' . $AG->articleID . '(' . $AG->index . ',1,\'' . $AG->imagesFolderName . '/' . $folderName . '\'); return false;" class="AG_album_thumb">'; $html .= '<span class="AG_album_thumb_img">'; if (!empty($thumb_file)) { $html .= '<img src="' . $AG->sitePath . PLUGIN_BASE_PATH . 'thumbs/' . $AG->imagesFolderName . '/' . $folderName . '/' . basename($thumb_file) . '" />' . "\n"; } else { $html .= '<img src="' . $AG->sitePath . PLUGIN_BASE_PATH . 'defaultAlbum.png" />' . "\n"; } $html .= '</span>';
function onPrepareContent(&$row, &$params, $limitstart) { $gd_exists = true; // just startup global $mainframe; // checking if (!preg_match("#{AdmirorGallery[^}]*}(.*?){/AdmirorGallery}#s", $row->text)) { return; } // GD2 Library Check if (!function_exists('gd_info')) { // ERROR - Invalid image $row->text .= _AD_NOGD; $gd_exists = false; } // Version check $version = new JVersion(); if ($version->PRODUCT == "Joomla!" && $version->RELEASE != "1.5") { echo '<div class="message">' . _AD_JV_CHECK . '</div>'; } // Load functions require_once JPATH_BASE . DS . 'plugins/content/AdmirorGallery/classes/agGallery.php'; require_once JPATH_BASE . DS . 'plugins/content/AdmirorGallery/classes/agHelper.php'; //CreateGallerys if (preg_match_all("#{AdmirorGallery[^}]*}(.*?){/AdmirorGallery}#s", $row->text, $matches, PREG_PATTERN_ORDER) > 0) { $plugin =& JPluginHelper::getPlugin('content', 'AdmirorGallery'); $ag = new agGallery(new JParameter($plugin->params)); $ag->setSitePath(JURI::base()); $ag->setThumbPath(JPATH_SITE . '/plugins/content/AdmirorGallery/thumbs/'); agHelper::ag_cleanThumbsFolder(JPATH_SITE . $ag->params['rootFolder'], $ag->thumbsPath); //if any image is corrupted supresses recoverable error ini_set('gd.jpeg_ignore_warning', $ag->params['ignoreError']); if ($ag->params['ignoreAllError']) { error_reporting('E_NOTICE'); } $ag->doc =& JFactory::getDocument(); $ag->addCSS('/plugins/content/AdmirorGallery/AdmirorGallery.css'); if ($ag->params['loadjQuery']) { $ag->addJavaScript('/plugins/content/AdmirorGallery/jquery.js'); } if ($ag->params['jQueryNoConflict']) { $ag->addJavaScriptCode('jQuery.noConflict();'); } $galleryCount = -1; $articleID = $row->id; //generate gallery html foreach ($matches[0] as $match) { $galleryCount++; $ag->readInlineParams($match); //set gallery path $ag->setImagesFolderName(preg_replace("/{.+?}/", "", $match)); $ag->setImagesFolderPath(JPATH_SITE . $ag->params['rootFolder'] . $ag->imagesFolderName . '/'); // ERROR - Cannot find folder with images if (!file_exists($ag->imagesFolderPath)) { $row->text .= '<div class="error">Cannot find folder "' . $ag->imagesFolderName . '" inside "' . $ag->imagesFolderPath . '" folder.</div>'; } // Create Image description array $imagesDescritions. Localization supported $ag->readDescriptionFiles(); //include (JPATH_BASE.DS.'plugins/content/AdmirorGallery/descriptions.php'); $ag->setThumbPath(JPATH_SITE . '/plugins/content/AdmirorGallery/thumbs/' . $ag->imagesFolderName . '/'); $ag->loadImageFiles(); if ($gd_exists) { // //Create directory in thumbs for gallery JFolder::create($ag->thumbsPath, 0755); $row->text .= $ag->generateThumbs(); } $popup = new POPUP(); include JPATH_BASE . DS . 'plugins/content/AdmirorGallery/popup_engine/' . $ag->params['popupEngine'] . '/index.php'; include JPATH_BASE . DS . 'plugins/content/AdmirorGallery/templates/' . $ag->params['galleryStyle'] . '/index.php'; agHelper::ag_clearOldThumbs($ag->thumbsPath, $ag->imagesFolderPath); $row->text = preg_replace("#{AdmirorGallery[^}]*}" . $ag->imagesFolderName . "{/AdmirorGallery}#s", "<div style='clear:both'></div>" . $html, $row->text, 1); } // foreach($matches[0] as $match) /* ========================= SIGNATURE ====================== */ // if ($ag->params['showSignature'] == "1") { $row->text .= '<div style="display:block; font-size:10px;">'; } else { $row->text .= '<div style="display:block; font-size:10px; overflow:hidden; height:1px; padding-top:1px;">'; } $row->text .= '<br /><a href="http://www.admiror-design-studio.com/admiror/en/design-resources/joomla-admiror-gallery" target="_blank">AdmirorGallery</a>, created by <a href="http://www.admiror-design-studio.com" target="_blank">Kekeljevic</a> & <a href="http://www.vasiljevski.com/" target="_blank">Vasiljevski</a>.<br />'; $row->text .= '</div>'; // /* ------------------------ SIGNATURE ---------------------- */ } //if (preg_match_all("#{AdmirorGallery}(.*?){/AdmirorGallery}#s", $row->text, $matches, PREG_PATTERN_ORDER)>0) }
function ag_sureRemoveDir($dir, $DeleteMe) { if (!($dh = @opendir($dir))) { return; } while (false !== ($obj = readdir($dh))) { if ($obj == '.' || $obj == '..') { continue; } if (!@unlink($dir . '/' . $obj)) { agHelper::ag_sureRemoveDir($dir . '/' . $obj, true); } } closedir($dh); if ($DeleteMe) { @rmdir($dir); } }