Image size and format info

Phoca Gallery - image gallery extension
Kirill
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 20 Jul 2008, 12:49

Image size and format info

Post by Kirill »

Jan, thank you for the great component!

Is there a way to display an information about a format of original images (XX x XX pixels) and size (in Kb, e.g.) near the images in category list layout? This information is present in "Image Download" window, but it'd be great to show it also near the images in albums or as overlib effect.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Image size and format info

Post by Jan »

Hi there is no such possibility, this must be manually done in html/php...

Jan
If you find Phoca extensions useful, please support the project
Kirill
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 20 Jul 2008, 12:49

Re: Image size and format info

Post by Kirill »

Please, could you explain what files I must edit to add this information to the images?.. :idea:
Kirill
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 20 Jul 2008, 12:49

Re: Image size and format info

Post by Kirill »

Ok, I've found a solution.
To add an information about size and format of original image as overlib effect in description field:
.../components/com_phocagallery/views/category/tmpl/default.php:
search for code (~ line #137):

Code: Select all

								} else if ((int)$value->overlib == 2){
									echo " onmouseover=\"return overlib('".htmlspecialchars( addslashes($value->description))."', CAPTION, '". $value->title."', BELOW, RIGHT, FGCOLOR, '".$this->olfgcolor."', BGCOLOR, '".$this->olbgcolor."', TEXTCOLOR, '".$this->oltfcolor."', CAPCOLOR, '".$this->olcfcolor."');\"";
									echo " onmouseout=\"return nd();\" ";
and replace it onto:

Code: Select all

								} else if ((int)$value->overlib == 2){
// get original image format and size:
list($Image_width, $Image_height) = PhocaGalleryHelperFront::getImageSizePhoca($value->filename);
if (!isset($Image_width) || !isset($Image_height)) {
    $Image_width 	= 0;
    $Image_height	= 0;
}
$Image_fsize = PhocaGalleryHelperFront::getFileSizePhoca($value->filename);
if( !isset($Image_fsize) ) {
    $Image_fsize = 0;
}
echo " onmouseover=\"return overlib('".htmlspecialchars( addslashes($value->description) . "<div style=\"color:red;font-size:7pt;\">".JText::_('Image Format').": ".$Image_width." x ".$Image_height."<br />".JText::_('Image Size').": ".$Image_fsize."</div>")."', CAPTION, '". $value->title."', BELOW, RIGHT, FGCOLOR, '".$this->olfgcolor."', BGCOLOR, '".$this->olbgcolor."', TEXTCOLOR, '".$this->oltfcolor."', CAPCOLOR, '".$this->olcfcolor."');\"";
									echo " onmouseout=\"return nd();\" ";
:)
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Image size and format info

Post by Jan »

great...

Jan
If you find Phoca extensions useful, please support the project
Post Reply