Mage_Catalog_Block_Product_Gallery Class Reference

Inheritance diagram for Mage_Catalog_Block_Product_Gallery:

Mage_Core_Block_Template Mage_Core_Block_Abstract Varien_Object

List of all members.

Public Member Functions

 getProduct ()
 getGalleryCollection ()
 getCurrentImage ()
 getImageUrl ()
 getImageFile ()
 getImageWidth ()
 getPreviusImage ()
 getNextImage ()
 getPreviusImageUrl ()
 getNextImageUrl ()

Protected Member Functions

 _prepareLayout ()


Detailed Description

Definition at line 34 of file Gallery.php.


Member Function Documentation

_prepareLayout (  )  [protected]

Preparing global layout

You can redefine this method in child classes for changin layout

Returns:
Mage_Core_Block_Abstract

Reimplemented from Mage_Core_Block_Abstract.

Definition at line 36 of file Gallery.php.

00037     {
00038         if ($headBlock = $this->getLayout()->getBlock('head')) {
00039             $headBlock->setTitle($this->getProduct()->getMetaTitle());
00040         }
00041         return parent::_prepareLayout();
00042     }

getCurrentImage (  ) 

Definition at line 53 of file Gallery.php.

00054     {
00055         $imageId = $this->getRequest()->getParam('image');
00056         $image = null;
00057         if ($imageId) {
00058             $image = $this->getGalleryCollection()->getItemById($imageId);
00059         }
00060 
00061         if (!$image) {
00062             $image = $this->getGalleryCollection()->getFirstItem();
00063         }
00064         return $image;
00065     }

getGalleryCollection (  ) 

Definition at line 48 of file Gallery.php.

00049     {
00050         return $this->getProduct()->getMediaGalleryImages();
00051     }

getImageFile (  ) 

Definition at line 72 of file Gallery.php.

00073     {
00074         return $this->getCurrentImage()->getFile();
00075     }

getImageUrl (  ) 

Definition at line 67 of file Gallery.php.

00068     {
00069         return $this->getCurrentImage()->getUrl();
00070     }

getImageWidth (  ) 

Definition at line 77 of file Gallery.php.

00078     {
00079         $file = $this->getCurrentImage()->getPath();
00080         if (file_exists($file)) {
00081             $size = getimagesize($file);
00082             if (isset($size[0]) && $size[0]>600) {
00083                 return 600;
00084             }
00085         }
00086         return false;
00087     }

getNextImage (  ) 

Definition at line 105 of file Gallery.php.

00106     {
00107         $current = $this->getCurrentImage();
00108         if (!$current) {
00109             return false;
00110         }
00111 
00112         $next = false;
00113         $currentFind = false;
00114         foreach ($this->getGalleryCollection() as $image) {
00115             if ($currentFind) {
00116                 return $image;
00117             }
00118             if ($image->getValueId() == $current->getValueId()) {
00119                 $currentFind = true;
00120             }
00121         }
00122         return $next;
00123     }

getNextImageUrl (  ) 

Definition at line 133 of file Gallery.php.

00134     {
00135         if ($image = $this->getNextImage()) {
00136             return $this->getUrl('*/*/*', array('_current'=>true, 'image'=>$image->getValueId()));
00137         }
00138         return false;
00139     }

getPreviusImage (  ) 

Definition at line 89 of file Gallery.php.

00090     {
00091         $current = $this->getCurrentImage();
00092         if (!$current) {
00093             return false;
00094         }
00095         $previus = false;
00096         foreach ($this->getGalleryCollection() as $image) {
00097             if ($image->getValueId() == $current->getValueId()) {
00098                 return $previus;
00099             }
00100             $previus = $image;
00101         }
00102         return $previus;
00103     }

getPreviusImageUrl (  ) 

Definition at line 125 of file Gallery.php.

00126     {
00127         if ($image = $this->getPreviusImage()) {
00128             return $this->getUrl('*/*/*', array('_current'=>true, 'image'=>$image->getValueId()));
00129         }
00130         return false;
00131     }

getProduct (  ) 

Definition at line 43 of file Gallery.php.

00044     {
00045         return Mage::registry('product');
00046     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:36 2009 for Magento by  doxygen 1.5.8