Choose which image to use in the popup - original, large...

Phoca Photo - image gallery extension
Gruz
Phoca Enthusiast
Phoca Enthusiast
Posts: 61
Joined: 26 Dec 2008, 19:09
Location: Ukraine
Contact:

Choose which image to use in the popup - original, large...

Post by Gruz »

In PhocaPhoto 3.0.0 in the Category View the image in the popup is the large thumbnail.
Image
I wanted to use an original image instead.
Image

Surely I can override the category template, but it would be nice to create such an option on backend.
Image

So here is my code which I propose.

Language constants:

Code: Select all

COM_PHOCAPHOTO_FIELD_IMAGE_POPUP_SOURCE_LABEL="Which image to use in the popup?"
COM_PHOCAPHOTO_FIELD_IMAGE_POPUP_SOURCE_DESC="You may choose which image has to be open in the popup window. As a rule it should be Original or Large. Using Medium or small has not much sense, but possibe"
COM_PHOCAPHOTO_ORIGINAL="Original"
COM_PHOCAPHOTO_LARGE="Large"
COM_PHOCAPHOTO_MEDIUM="Medium"
COM_PHOCAPHOTO_SMALL="Small"
XML change. File administrator/components/com_phocaphoto/config.xml in line 44 after

Code: Select all

<field name="image_link" type="list" class="btn-group btn-group-yesno" default="0" label="COM_PHOCAPHOTO_FIELD_IMAGE_LINK_LABEL" description="COM_PHOCAPHOTO_FIELD_IMAGE_LINK_DESC">
	<option value="0">COM_PHOCAPHOTO_NO_POPUP_SITE</option>
	<option value="1">COM_PHOCAPHOTO_POPUP_WINDOW</option>
</field>
add

Code: Select all

<field name="image_popup_source" type="list" class="btn-group btn-group-yesno" default="large" label="COM_PHOCAPHOTO_FIELD_IMAGE_POPUP_SOURCE_LABEL" description="COM_PHOCAPHOTO_FIELD_IMAGE_POPUP_SOURCE_DESC">
	<option value="original">COM_PHOCAPHOTO_ORIGINAL</option>
	<option value="large">COM_PHOCAPHOTO_LARGE</option>
	<option value="medium">COM_PHOCAPHOTO_MEDIUM</option>
	<option value="small">COM_PHOCAPHOTO_SMALL</option>
</field>
In file components/com_phocaphoto/views/category/view.html.php line 55 after

Code: Select all

$this->t['image_link']				= $this->t['p']->get( 'image_link', 0 );
add

Code: Select all

$this->t['image_popup_source']				= $this->t['p']->get( 'image_popup_source', 'large' );
And finally in file components/com_phocaphoto/views/category/tmpl/default.php in line 93 instead of

Code: Select all

			$imageL = PhocaPhotoHelper::getThumbnailName($this->t['path'], $v->filename, 'large');
			$link = JURI::base(true).'/'.$imageL->rel;
use code

Code: Select all

			if ($this->t['image_popup_source'] == 'original') {
				$link = JURI::base(true).'/'.$this->t['path']->image_rel.$v->filename;
			} else {
				$imageL = PhocaPhotoHelper::getThumbnailName($this->t['path'], $v->filename, $this->t['image_popup_source']);
				$link = JURI::base(true).'/'.$imageL->rel;
			}


Compatibilty with the previous version seems to be preserved.

Please let me know if you are going to implement the code into the next version. I must know whether to use the stay on the patched code base (be sure the next version doesn't kill my changes), or I have to use a template instead.

Thank you!
Last edited by Gruz on 12 May 2016, 15:40, edited 1 time in total.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Choose which image to use in the popup - original, large

Post by Jan »

Hi, thank you for the info, yes, I think, this can be implemented. The only question is, if "medium" and "small" value makes sense in the option :idea:

Jan
If you find Phoca extensions useful, please support the project
Gruz
Phoca Enthusiast
Phoca Enthusiast
Posts: 61
Joined: 26 Dec 2008, 19:09
Location: Ukraine
Contact:

Re: Choose which image to use in the popup - original, large

Post by Gruz »

It doesn't make sense, but the I'd leave it there. The text description tell about it.
Maybe, who know, someone will create a menu link for mobile devices to show small thumbs and to open medium. :-)
Last edited by Gruz on 12 May 2016, 15:40, edited 1 time in total.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47810
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Choose which image to use in the popup - original, large

Post by Jan »

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