"Random image" instead of folder icon limited to 2 level deep

Phoca Gallery - image gallery extension
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

"Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

Thanks in advance for help. I am using PG 4.2.2 w/ Joomla 3.2.7. I have multi-level albums and enabled "Show random image" rather than "folder icon". It works fine as long the actual images are within 2 levels below the album. For instance in the following hierarchy
Albums->Spain-Portugal-2015->Portugal->Faro the pics are under Faro. With this example "Spain-Portugal-2015" will show the folder icon, while "Portugal: will show a random image from "Faro" (or other place at same level). I did not find a way to configure the number of levels scanned for images nor a way to at least associate a static image from the album with the category ("Spain-Portugal-2015" in this example). Kindly advise / help. The same albums with same structure are in the older site using PG 2.8.0 and the "show random image" works fine regardless of the levels.

The other issues I have and I would appreciate advice & help
- Activating (uploading) a "Theme" does not seem to produce any expected change in the layout - although it says it's using that theme
In PG 2.8.0 this was working.
- Increasing the "name text" length does not seem to take effect

Thanks a lot
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48663
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: "Random image" instead of folder icon limited to 2 level deep

Post by Jan »

Hi,

there is no parameter for number of levels, it just should go through all levels in category tree with the help of recursive function :idea:

regarding themes: Install the latest version 4.3.0, for now there is only one theme for version 4.x - see:
https://www.phoca.cz/download/category/3 ... ery-themes

Increasing the "name text" length does not seem to take effect - hmm testing now without any problem :idea:

Anyway, in version 4.3.x you can set own specific image for category:
Image

Jan
If you find Phoca extensions useful, please support the project
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

Re: "Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

Hi Jan and thanks for your help. Unfortunately can't upgrade to PG 4.3.0 => tried it on Joomla 3.2.7. it installs but the category view layout is broken, showing only the first item (category or pic) out of many at the same level. Not sure where the issue is. And can't upgrade to Joomla 3.5 - too many components would break. Kindly advise if any patch exists for PG 4.3.0 making it compatible with J 3.2.7.
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

Re: "Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

One of the issues with PH 4.3.0 on Joomla 3.2 "PHP Fatal error: Class 'Joomla\String\StringHelper' not found " Indeed the whole "vendor" subfolder under libraries is missing in Joomla 3.2.7 (libraries/vendor/joomla/string/src/StringHelper.php).
christine
Phoca Hero
Phoca Hero
Posts: 2872
Joined: 28 Nov 2010, 17:20

Re: "Random image" instead of folder icon limited to 2 level deep

Post by christine »

Hi,
can't upgrade to Joomla 3.5 - too many components would break.
see: *)
One of the issues with PH 4.3.0 on Joomla 3.2 "PHP Fatal error: Class 'Joomla\String\StringHelper' not found " Indeed the whole "vendor" subfolder under libraries is missing in Joomla 3.2.7 (libraries/vendor/joomla/string/src/StringHelper.php)
Changes etc. (2015): https://github.com/joomla/joomla-cms/pull/6600 > updated in J 3.5
Kindly advise if any patch exists for PG 4.3.0 making it compatible with J 3.2.7.
this does not make sense, because: *)

- since J 3.2.7 (you are running) - many security fixes were implemented. So, 3.2.7 is unsecure!

- Which PHP version are you using? e.g. PHP 7 is recommended since ca. J 3.5

- J 3.2.7 is not compatible with PHP 7. Maybe your hoster has changed at least to: PHP 5.6

- some other extensions, components etc. could be broken and/or missing Codes changes etc. etc. as:

- extensions, in this case, Phocagallery etc. were adjusted to latest Joomla! Core versions (J 3.6), concerning to:
Core amendments, updates, new features, bug fixes and much more .....

Kind regards, Christine
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

Re: "Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

Hi Christine and thanks for your feedback. The problem with showing the folder icon stems from the "access" value in j_phocagallery_categories table (fix viewtopic.php?t=16603&p=66507) . In my case, as everything was imported from PG 2.8.0 this field was 0 for all categories in the hierarchy (and somehow PG was showing "Access=guest" in the imported categories). Therefore the SELECT in PhocaGalleryImageFront::getRandomImageRecursive was returning NULLand PhocaGalleryImageFront::displayCategoryImageOrFolder was returning the folder icon. Once I updated the "access" field to "public" (1) the random thumbnails started showing. What I can't explain though (and did not take the time to trace the code): (1) why for lower-levels subcategories in the hierarchy, although "access" was still 0, thumbnails were showing (2) what's the logic of showing the folder icon rather than skipping that category if nothing is accessible in a category for the current user.
BTW if my site is in English, do I really need the utf-8 support with StringHelper? There are plenty of other places where the String functions are being used - and replacing the StringHelper calls with the equivalent String ones solved the PHP error with 4.3.0 in Joomla 3.2.7

Thanks for your help
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

Re: "Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

Hi

I really need to understand how the "responsive" theme should work - and thanks in advance for advice.
For now I can't tell if this is really functional as I don't see any difference with or without the "responsive" css.
With 4.3.0 more or less functional I have installed the "responsive" thems. THe CSS files were installed in <j-base>/media/com_phocagallery/css/main respectively ./custom. However looking in the code I see they are expected to be in <j-base>/media/com_phocagallery/css/. I have created the symlinks for phocagallery.css and phocagallerycustom.css (to ./custom/custom_responsive.css). And there are some settings visibly being used in the code (enablecustomcss and customcss) that I don't know where to find in the parameters.

// CSS
JHtml::stylesheet('media/com_phocagallery/css/phocagallery.css' );
if ($this->tmpl['enablecustomcss'] == 1) {
JHtml::stylesheet('media/com_phocagallery/css/phocagallerycustom.css' );
if ($this->tmpl['customcss'] != ''){
$document->addCustomTag( "\n <style type=\"text/css\"> \n"
.$this->escape(strip_tags($this->tmpl['customcss']))
."\n </style> \n");

}
}

Not sure what are the "Detail view" parameter settings for the theme to take effect.

Thanks for your help
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48663
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: "Random image" instead of folder icon limited to 2 level deep

Post by Jan »

Hi,
Once I updated the "access" field to "public" (1) the random thumbnails started showing.
as everything was imported from PG 2.8.0
see:
https://www.phoca.cz/documents/50-phoca/ ... -joomla-25
Now all Phoca Gallery data are imported.

If access was not set in Phoca Gallery in Joomla! 1.5 and all categories are public, likely, you need to run the following queries:
UPDATE `jos_phocagallery_categories` SET `access` = '1';
Yes, there were changes regarding the acess rights. Even now there are new changes in version 4.3.0 (strict rule is applied) - I am now working on 4.3.1 where the access rights could be reset, etc. to prevent from wrong hanlding if obsolete values stay in database.
BTW if my site is in English, do I really need the utf-8 support with StringHelper? There are plenty of other places where the String functions are being used - and replacing the StringHelper calls with the equivalent String ones solved the PHP error with 4.3.0 in Joomla 3.2.7
Unfortunately, I am not the one, who somehow decides which functions will be used in Joomla!, which will be updated, etc. In version 4.3.0 I just made the changes to fit new Joomla! rules. The latest version should always be compatible with latest version of Joomla! (of course there are so many changes, not only I Joomla! but in all the external libraries and APIs, that sometimes, implementing new feature, new function takes some time)
Kindly advise if any patch exists for PG 4.3.0 making it compatible with J 3.2.7.
As I know, there is no patch and unfortunately, for me it is not possible to release new version which should work for newest Joomla! and make patches for obsolete versions. As I manage over (I really don't know) 500.000 lines of code in my extesions, it is not possible to make hundreds of patch for oboslete version. The only idea is to install some old version of Phoca Gallery to old version of Joomla! - but of course this is not recommended :idea: And of course responsive theme will not work

I really need to understand how the "responsive" theme should work
See:
https://www.youtube.com/watch?v=odIoUyv-ncE
A theme does in fact two actions:
- it installs custom.css - which can be disabled in Styles (administration of Phoca Gallery)
- and change selected parameters in Options (which can be of course disabled too), in case of responsive theme:

Code: Select all

<param name="responsive" default="1" />
<param name="bootstrap_icons" default="1" />
<param name="detail_window" default="7" />
It enables responsive parameter, bootstrap_icons parameter and set the detail window to method 7 (No Popup - of course can be set to won popup window)



Jan
If you find Phoca extensions useful, please support the project
debugnetiq1
Phoca Member
Phoca Member
Posts: 11
Joined: 22 Jul 2016, 03:47

Re: "Random image" instead of folder icon limited to 2 level deep

Post by debugnetiq1 »

In fact very simple explanation (and possibly bug). All categories and subcategories had the "access" field 0 (unset) and access level verification when recursively going through subcategories a.access (=0) was not matching any of my groups in the select. Just patched it:
public static function getRandomCategory($parentid, $ordering = ' ORDER BY RAND()')
$db =JFactory::getDBO();

$groups = JFactory::getUser()->getAuthorisedViewLevels();
if (count($groups)) {
// $access = ' AND a.access IN(' . implode(',', $groups) . ')';
$access = ' AND a.access IN(' . implode(',', $groups) . ', 0)'; // MRo: added 0
} else {
$access = '';
}
$query = 'SELECT a.id, a.extid' .
' FROM #__phocagallery_categories AS a' .
' WHERE a.parent_id = '.(int) $parentid .
' AND a.published = 1 ' .
$access .
$ordering;
$db->setQuery($query);
$images = $db->loadObjectList();

return $images;
}

In any case the permission check was moot. The 1'st level images in the category (and any sub-category when drilling-down) were retrieved and displayed. But the next level of recursion was dropping all the sub-categories.
Post Reply