Closed (fixed)
Project:
Album Photos
Version:
6.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 May 2021 at 13:37 UTC
Updated:
31 May 2021 at 18:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
nathaniel commentedI don't think the setting exists. It could probably be added fairly easily though. We'll have to update the PhotosUpload service and the validation for the photos_image entity form to display a message that the maximum number of images for the album has been reached and prevent new images from being added.
On /admin/config/media/photos we can add a setting under upload or maybe under album limit called "Maximum number of photos per album".
Any other ideas for functionality / wording?
Comment #3
frontmobeHi Nathaniel,
Thanks for your quick feedback, I think that would be a great way to add the functionality of setting a maximum number of photos per album.
I attached an elementary patch that updates the PhotosUpload service and validation for the photos_image entity form, like you mentioned. To keep things simple, I set $album_max_size in the code for now but setting that value in the module config at /admin/config/media/photos under "Album limit" definitely sounds like the way to go.
One thing that still puzzles me is that although I include "return FALSE;" in the service, the image still is created as a Drupal file on the file system. The image is not included in the album (due to the validation in the form), but returning FALSE when $photocount exceeds the maximum number of photos per album does not prevent the creation of the Drupal file. Do you have any suggestions on how to solve this?
Especially when using plupload to upload a large number of photos, this would otherwise mean that still many Drupal files would be created even though the limit is exceeded.
Have a good weekend!
Comment #4
nathaniel commentedChanging to needs review.
Comment #5
nathaniel commentedGood start, thanks for the patch!
Added the option on /admin/config/media/photos under "Album limit". Made some changes and added some functionality throughout the various upload options.
Looks like I need to do a little more cleanup and dependency injection, but let me know if the functionality works now?
Comment #6
frontmobeHi Nathaniel,
I can confirm the functionality in the patch works perfectly! The config under /admin/config/media/photos -> "Album limit" is clear and the added messages are too. Uploading more images than allowed now also does not result in Drupal files being created for the excess images, which keeps things tidy. This works when using Plupload or using the default file widgets on the upload form.
From a functionality standpoint I would say this is now complete, thank you for working on this so quickly!
Cheers,
Marco
Comment #7
frontmobeComment #9
nathaniel commentedComment #10
nathaniel commentedNote: when updating to the latest dev cache may need to be cleared.