Choose which image to use in the popup - original, large...
Posted: 02 May 2016, 21:32
In PhocaPhoto 3.0.0 in the Category View the image in the popup is the large thumbnail.
I wanted to use an original image instead.
Surely I can override the category template, but it would be nice to create such an option on backend.
So here is my code which I propose.
Language constants:
XML change. File administrator/components/com_phocaphoto/config.xml in line 44 after
add
In file components/com_phocaphoto/views/category/view.html.php line 55 after
add
And finally in file components/com_phocaphoto/views/category/tmpl/default.php in line 93 instead of
use code
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!
I wanted to use an original image instead.
Surely I can override the category template, but it would be nice to create such an option on backend.
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"
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>
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>
Code: Select all
$this->t['image_link'] = $this->t['p']->get( 'image_link', 0 );
Code: Select all
$this->t['image_popup_source'] = $this->t['p']->get( 'image_popup_source', 'large' );
Code: Select all
$imageL = PhocaPhotoHelper::getThumbnailName($this->t['path'], $v->filename, 'large');
$link = JURI::base(true).'/'.$imageL->rel;
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!