Coder Social home page Coder Social logo

piwigo / piwigo-smartalbums Goto Github PK

View Code? Open in Web Editor NEW
8.0 6.0 6.0 317 KB

Create dynamic Piwigo albums by photos' tags, dates or with a photo limit.

Home Page: http://piwigo.org/ext/extension_view.php?eid=544

License: GNU General Public License v2.0

PHP 89.40% CSS 0.73% Smarty 9.87%

piwigo-smartalbums's Introduction

piwigo-smartalbums's People

Contributors

7tonin avatar abrenoch avatar ddtddt avatar erack avatar mistic100 avatar piwigo-translationteam avatar plegall avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

piwigo-smartalbums's Issues

SmartAlbums make piwigo not reachable

Since the last update of piwigo I observe the following problem:

After activation of SmartAlbums the website works for a short time. Then it does not respond anymore. Renaming the plugin folder of SmartAlbums fixes the problem.
Actually I've no idea how to give more debugging information. I'd like to help fixing this.

Thank you!

Smart Album of Albums?

I understand that Smart Albums is designed to work with putting photos into albums. It works great and does one of the things I need it to do!

What I was wondering is if there was a way to create a Smart Album containing only other albums? Basically I have albums upon sub albums upon sub albums. I want to be able to create an album that organizes the third level albums together when they have a specific tag on the photos.

Kind of convoluted, but if an album contains photos of a certain tag, it should return the album instead of the photos. Obviously it would be better if albums had the ability to be tagged themselves, but all I have are photo tags.

abusive reset of album thumbnail

When you use images from a dedicated album for your "covers" (or "album thumbnail" or "representative image"), plugin SmartAlbums does not care and sets a new random cover when the smart album is rebuilt.

We need to avoid that.

No filters for SmartAlbum in Piwigo 13.8

Using Piwigo and SmartAlbums since years now I'm facing a problem I can't help myself:
Editing an album I select SmartAlbum. Here I just can check a checkbox to define this album as a SmartAlbum. If I save, it tells me the number of images of this album. This number is the number of all images managed by piwigo. There are no filter options any more, no error messages.
Because I'm using an old installation, I installed piwigo again to have a clean system. But it is the same.

I would expect to see all the filter options I got all the years before.

Thank you for every idea!

Ubuntu 22.04.3 LTS
PHP Version 8.1.2-1ubuntu2.14
mariadb Ver 15.1 Distrib 10.6.12-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper

no preview image generated on new smart album

after creating a new smart album and adding a condition that populates the smart album with some images the smart album does not generate a preview image automatically. you can do so by hand.

because albums without preview image are not shown in the gallery this leads to confusing circumstances: the just created album, that has images in it is not shown. why?

after choosing a preview image by hand things return to normal.

Create Smart Albums based on SQL request

Hi

Would it be possible to add the ability to create Smart Albums based on a single SQL request ?
I think that would add quite a lot of versatility.

Best regards

SQL Error with Filter "Only These Albums" + Child Albums.

Trying to select specific albums with the tag "Only These Albums" + Child Albums results in this SQL error:

Warning: [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT DISTINCT(id)
FROM piwigo_categories
WHERE uppercats REGEXP '(^|,)4...' at line 16

This is the code being executed:

SELECT i.id
  FROM piwigo_images AS i
  WHERE
    i.id NOT IN (
      SELECT image_id
        FROM piwigo_image_category
        WHERE category_id NOT IN(
SELECT DISTINCT(id)
  FROM piwigo_categories
  WHERE uppercats REGEXP '(^|,)41(,|$)')
      )
    and i.id IN (
      SELECT image_id
        FROM piwigo_image_category
        WHERE category_id = 
SELECT DISTINCT(id)
  FROM piwigo_categories
  WHERE uppercats REGEXP '(^|,)41(,|$)'
      )
  GROUP BY i.id
  ORDER BY date_available DESC, file ASC, id ASC

Which should probably be:

SELECT i.id
  FROM piwigo_images AS i
  WHERE
    i.id NOT IN (
      SELECT image_id
        FROM piwigo_image_category
        WHERE category_id NOT IN(
SELECT DISTINCT(id)
  FROM piwigo_categories
  WHERE uppercats REGEXP '(^|,)41(,|$)')
      )
    and i.id IN (
      SELECT image_id
        FROM piwigo_image_category
        WHERE category_id IN ( 
SELECT DISTINCT(id)
  FROM piwigo_categories
  WHERE uppercats REGEXP '(^|,)41(,|$)'
      )
)
  GROUP BY i.id
  ORDER BY date_available DESC, file ASC, id ASC

This change is going from an equal operator to an IN list with parentheses.

Mistake with "at least one filter" and a pair of "All these tags"

Hi,
when filter second radio is checked "Photos must match at least one filter" (OR) and a pair of "All these tags" (AND) is set as follow:

  • The first with tag1a AND tag1b, and
  • the second with tag2a AND tag2b.

There is a problem to count, and to save. Very long. And the result is not what I expect.
I expect the SQL WHERE to be somehow like (tag1a AND tag1b) OR (tag2a AND tag2b).

Compatibility issues with PHP 8.0 and 8.1

Is the SmartAlbums compatible with php versions newer that 7.4? When I use newer php versions, I cannot define criteria for a smart album. Nothing happens after clicking on "This album is a SmartAlbum". After downgrading the php version, everything works as usual. However the php 7.4 is deprecated, so it is risky to use it.

Smartalbum shows unauthorized picture as Album-Preview picture when SmartAlbums are excluded from perm mgmt

Hello,

I love this plugin. It makes it easy to categorize the pictures. I just activated the feature "Exclude SmartAlbums from permissions management" and recognized two issues:

  1. The Album Preview picture might be a picture where the user has no permission to view it
  2. The number of pictures in the SmartAlbum is equal to the overall pictures in this album if the user would be permissioned to view all of them. But in reality fewer pictures might be available to the users, if album access is restricted.

Is there a way to restrict the shown number of pictures in the album to the number of pictures where the user is permissioned to? And is it possible to limit the allowed preview pictures to the ones where the suer is allowed to see them?

Thanks and kind regards

Jens

Plugin overloads DB column data allowance

I've seen this problem for a long time now - maintain.class.php:123 seems to continually concat 'false' into the existing value for every navigation within piwigo. If left unchecked it will eventually hit the column limit and start throwing database errors in the web ui, which then requires manually correcting the database.

If there is a reason for this, please share... I'm struggling to understand how this behavior is useful.

Unexpected behavior from Albums->Manage

New install Pwigo 13.1.0, PHP 8.1 {bcmath,fpm,xml,mysql,zip,intl,ldap,gd,cli,bz2,curl,mbstring,pgsql,opcache,soap,cgi}, Mariadb 10.5.15

When you select "This is a SmartAlbum" from the Albums->Manage "SmartAlbum" tab, you do not get any options and it selects all photos.

When you access with the Plugins Menu and select SmartAlbums->Settings 'Create a new SmartAlbum" you get the two warnings below:

Warning: Undefined array key "filters" in /var/www/xxx.home.ca/_data/templates_c/p6jhns^5eb571b15d017e45c914fcaea3127b1e40edd927_0.file.album.tpl.php on line 386

Warning: Attempt to read property "value" on null in /var/www/xxx.home.ca/_data/templates_c/p6jhns^5eb571b15d017e45c914fcaea3127b1e40edd927_0.file.album.tpl.php on line 386

If you continue and use the "add a filter" dropdown, you can select a filter type, but cannot add the particulars of the filter

No apparent issues on old install with PHP7.4

Regenerate smart album from user side

An useful feature of smart album plugin would be to allow regeneration of the current smart album from user’s side.
for exemple

  • an option in smart album (admin side)
  • when this option is set to yes/true, a button (or else) triggers album regeneration on album page

Guest user causes entire image list to be loaded

I originally posted (parts of) the following on the official Piwigo forums when I thought it was a core issue, but it turns out it's in SmartAlbums.

So I've been working on optimising my 166 thousand image piwigo gallery and I noticed that guest users were loading pages a lot slower than my admin user.

For example, the admin user loads category 1 with a (chrome reported) wait time of 141ms. The guest user takes between 3.95 seconds and over 10 seconds.

So I looked at the queries and found the following:

For the administrator:

SELECT *
  FROM piwigo_categories
  WHERE id = 1
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.017 s)
(num rows        : 1 )

[11] 
SELECT DISTINCT(image_id)
  FROM piwigo_image_category
    INNER JOIN piwigo_images ON id = image_id
  WHERE
    category_id = 1

  ORDER BY file ASC, id ASC
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.017 s)
(num rows        : 0 )

[12] 
SELECT DISTINCT category_id
  FROM piwigo_category_filters
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.017 s)
(num rows        : 1 )

[13] 
SELECT pt.id, pt.visible, pt.nfo, ptl.lang, ptl.title, ptl.content
          FROM piwigo_amm_personalised pt
            LEFT JOIN piwigo_amm_personalised_langs ptl
            ON pt.id=ptl.id
          WHERE (ptl.lang = '*' OR ptl.lang = 'en_GB')  AND ptl.content != ''  ORDER BY pt.id, ptl.lang ASC 
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.017 s)
(num rows        : 0 )

And for the guest:

[12] 
SELECT *
  FROM piwigo_categories
  WHERE id = 1
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.031 s)
(num rows        : 1 )

[12] 
SELECT DISTINCT(image_id)
  FROM piwigo_image_category
    INNER JOIN piwigo_images ON id = image_id
  WHERE
    category_id = 1
AND (category_id NOT IN (1694,675,676,677,678,1340,1373,1363,1361,1365,1367,1343,1347,1345,1359,1379,1383,1355,1375,1357,1377,1349,1381,1371,1353,1351,1369,3090,3057,3058,3073,3074,5209,2846))
  ORDER BY name ASC,file ASC, id ASC
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.031 s)
(num rows        : 0 )

[13] 
SELECT DISTINCT category_id
  FROM piwigo_category_filters
;
(this query time : 0.000 s)
(total SQL time  : 0.001 s)
(total time      : 0.031 s)
(num rows        : 1 )

[14] 
SELECT id
  FROM piwigo_categories
  WHERE
    (id NOT IN (1694,675,676,677,678,1340,1373,1363,1361,1365,1367,1343,1347,1345,1359,1379,1383,1355,1375,1357,1377,1349,1381,1371,1353,1351,1369,3090,3057,3058,3073,3074,5209,2846,5234))
(this query time : 0.000 s)
(total SQL time  : 0.002 s)
(total time      : 0.032 s)
(num rows        : 3771 )

[15] 
SELECT DISTINCT(image_id)
  FROM piwigo_image_category
    INNER JOIN piwigo_images ON id = image_id
  WHERE
    category_id IN (1,3, ...)

  ORDER BY name ASC,file ASC, id ASC
;
(this query time : 10.852 s)
(total SQL time  : 10.853 s)
(total time      : 10.884 s)
(num rows        : 168736 )

[16] 
SELECT pt.id, pt.visible, pt.nfo, ptl.lang, ptl.title, ptl.content
          FROM piwigo_amm_personalised pt
            LEFT JOIN piwigo_amm_personalised_langs ptl
            ON pt.id=ptl.id
          WHERE (ptl.lang = '*' OR ptl.lang = 'en_GB')  AND ptl.content != ''  ORDER BY pt.id, ptl.lang ASC 
(this query time : 0.000 s)
(total SQL time  : 10.854 s)
(total time      : 10.947 s)
(num rows        : 0 )

Two things to note about the above:

  1. I removed a huge list if category numbers in query 15 for the guest for clarity
  2. Yes, there actually are two number 11 queries for the admin and two number 12 queries for the guest listed on the generated web pages.

Note that query 15 ends up selecting every image in the database and then, just to make things worse, sorts them on fields that aren't indexed in the database

So the administrator seems to skip queries 14 and 15 (from the guest list) no apparent ill effect on the web page, but the guest account basically thrashes the database.

Obviously query 15 is the one at the bottom of events.inc.php. As it stands, this is a hugely expensive operation on larger databases. Is there any reason this couldn't be limited to the current category and it's children (if in flat mode)? Indeed, if $pages['items'] is already populated, couldn't the query be omitted totally and just remove the images from the list the user isn't supposed to see?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.