jradwan / piwigo-physical_photo_move Goto Github PK
View Code? Open in Web Editor NEWPiwigo extension to move a photo, video, or album from one physical album to another, preserving all metadata.
Piwigo extension to move a photo, video, or album from one physical album to another, preserving all metadata.
Just realized that if you move a root level (i.e., under /piwigo/galleries) folder to a sub-folder, there's no way to move it back to the root level.
I need to figure out a way to add a root node to the album list.
Add option to move an entire physical album to a new location (i.e., move folder instead of individual file(s)).
Hi Jeremy,
I've installed your plugin to move picture in phys. folder to new location using batch mode. As result all original picture was removed to new destination but not one of dependent pictures with different size.
I got tons of messages like:
Warning: mkdir(): No such file or directory in /srv/www/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 261
Warning: rename(./_data/i/./galleries/Reisen/1997_Mexiko/Mexico_Flag-2s.png,./_data/i/./galleries/Reisen_bis_2000/1997_Mexico/Mexico_Flag-2s.png): No such file or directory in /srv/www/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 268
Warning: rename(./_data/i/./galleries/Reisen/1997_Mexiko/Mexico_Flag-me.png,./_data/i/./galleries/Reisen_bis_2000/1997_Mexico/Mexico_Flag-me.png): No such file or directory in /srv/www/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 268
Warning: rename(./_data/i/./galleries/Reisen/1997_Mexiko/Mexico_Flag-sm.png,./_data/i/./galleries/Reisen_bis_2000/1997_Mexico/Mexico_Flag-sm.png): No such file or directory in /srv/www/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 268
Warning: rename(./_data/i/./galleries/Reisen/1997_Mexiko/Mexico_Flag-sq.png,./_data/i/./galleries/Reisen_bis_2000/1997_Mexico/Mexico_Flag-sq.png): No such file or directory in /srv/www/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 268
All my pictures are in subfolders of: ../galleries/
All dependecies are in subfolders of ../_data/i/galleries/
I suppose one reason is a komma after file name (.png,./_data/) and the dot in folder name
(/_data/i/./galleries)
/Mexico_Flag-sm.png,./_data/i/./galleries
Nice to get answer an correction.
Holger
From eliz82 on the Piwigo forums (post):
In some specific conditions Batch Manager can give some error
You know you are able to add (virtual) photos to physical albums from admin interface? For example you have some physical albums, go to "admin->photos->add" and you can select a physical album -> upload photos . Now the photos are in piwigo/upload/ folder (so they are not physical). But if you go to client font end they are showed in the same album as the physical photos. So you can combine the virtual photos and physical ones in a physical album.
Now if you go to Admin->Batch Manager->Add filter->Predefined filter->With no virtual albums
Well ... this also show both virtual and physical photos. Seems to me there is no way to filter only physical photos from a physical album.
If you select a virtual one by mistake and you try to move it => error
Warning: [mysql error 1064] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3
SELECT *
FROM piwigo_categories
WHERE id =
; in /www/local/piwigo/include/dblayer/functions_mysqli.inc.php on line 845
Fatal error: Uncaught Error: Call to a member function fetch_assoc() on boolean in /usr/local/piwigo-beta/include/dblayer/functions_mysqli.inc.php:226 Stack trace: #0 /usr/local/piwigo-beta/include/functions_category.inc.php(176): pwg_db_fetch_assoc(false) #1 /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php(102): get_cat_info(NULL) #2 /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php(79): ppm_move_photo('37', '431', true) #3 /usr/local/piwigo-beta/plugins/physical_photo_move/batch_global.php(77): ppm_move_item('37', '431', true, 'photo') #4 /usr/local/piwigo-beta/include/functions_plugins.inc.php(279): ppm_batch_global_submit('ppm', Array) #5 /usr/local/piwigo-beta/admin/batch_manager_global.php(425): trigger_notify('element_set_glo...', 'ppm', Array) #6 /usr/local/piwigo-beta/admin/batch_manager.php(795): include('/usr/local/piwi...') #7 /usr/local/piwigo-beta/admin.php(311): include('/usr/local/piwi...') #8 {main} thrown in /usr/local/piwigo-beta/include/dblayer/functions_mysqli.inc.php on line 226
When moving an item from one physical folder to another, if the source and target folders are on different devices (at the OS level), the PHP rename command will throw a warning.
For photos:
Warning: rename(./galleries/places/batch-test-02.png,./galleries/exp_PG_test/batch-test-02.png): Operation not permitted in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 187
For albums:
Warning: rename(): The first argument to copy() function cannot be a directory in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 435
Warning: rename(./galleries/exp_PG_test,./galleries/places/exp_PG_test): Invalid cross-device link in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 435
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(./galleries/places/exp_PG_test): failed to open dir: No such file or directory in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php:519 Stack trace: #0 /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php(519): DirectoryIterator->__construct('./galleries/pla...') #1 /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php(436): ppm_chmod_r('./galleries/pla...') #2 /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php(82): ppm_move_album('7', '37', false) #3 /usr/local/piwigo-beta/plugins/physical_photo_move/admin.php(69): ppm_move_item('7', '37', false, 'album') #4 /usr/local/piwigo-beta/admin/plugin.php(68): include_once('/usr/local/piwi...') #5 /usr/local/piwigo-beta/admin.php(311): include('/usr/local/piwi...') #6 {main} thrown in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 519
In the case of photos, it doesn't seem to stop processing and the files are correctly moved. For albums, however, the fatal error prevents the move from happening and the code from continuing.
This really only seems to happen if you use symbolic links, which I do: under Piwigo's galleries folder (i.e., /usr/local/piwigo/galleries) I have symbolic links out to my NAS.
It looks like maybe I should use the copy() and unlink() functions in this case.
I need to figure out now is how to manage the thumbnails, specifically:
Poking around in the Piwigo functions (like the uploader), I found delete_element_derivatives. Would this handle the thumbnails (-cu, -me, -sq, -th, etc.)? If so, would it also handle the pwg_representatives (i.e., thumbnails for videos created by videojs)?
Also posted here: http://piwigo.org/forum/viewtopic.php?id=28020
Getting an error with moving a new (blank) album in Piwigo 13.7 and PPM 2.10. I am trying to move a new album, nested inside of an album, into a different, new blank top-level album. Both albums created physically via SFTP, database resynchronized, and then attempting to do a physical move via the the plugin. I get this error:
Warning: Undefined variable $move_item_status_ok in ....../plugins/physical_photo_move/include/functions.inc.php on line 632
Warning: Undefined variable $move_item_status_ok in ....../plugins/physical_photo_move/include/functions.inc.php on line 646
Cannot modify header information - headers already sent by (output started at ....../plugins/physical_photo_move/include/functions.inc.php:632) in .../include/page_header.php on line 99
Piwigo: 13.7.0
Installed on 10 March 2019, 4 years 2 months 3 weeks 1 day ago
Operating system: Linux
PHP: 8.0.28
MySQL: 8.0.28-0ubuntu0.20.04.3
Graphics Library: External ImageMagick 6.9.7-4
This great plugin works as expected. However, there are two annoying issues.
When the Move is almost completed , t tries to delete the the source directory as the last step. But there are two circumstances when the deletion fails:
The plugin works fine in other cases, but it is annoying to have to manually delete the empty directories through the CLI.
Thanks for your efforts!
Cheers,
Mike
Using v2.04 installed through plugins list internally.
The gallery edit menu does not show the move tab.
The drop down option for physical move appears in the batch manager options but the destination albums list is not populated.
Using Clear "Mail" Theme
Piwigo 11.3.0
Operating system: Linux
PHP: 5.6.40 (Show info) [2021-02-08 21:09:25]
MySQL: 5.7.33 [2021-02-08 16:09:25]
Graphics Library: ImageMagick 7.0.10-10
New language: Russian. All words translated.
I'm 80% satisfied with result for now, because of very misleading words to describe difference between physical and virtual when we talk about files and filders.
PPM_ru_RU_by_evadim.tar.gz
Hello! Something goes wrong! After installing from Piwigo 2.9.3. web plugin manager i did not find PPM tab in the property of image.
My host operating system is Gentoo, web server is apache 2.4 and php -7.0
The new data-selectize-based dropdown on the individual photo/album page in 2.10 isn't styled the same way as on the Batch Manager:
It must be a CSS/script thing but I can't figure out what's missing. The user should be able to type in field to search, and the control should look "prettier." Strangely, though, the sort order of the albums is correct, unlike in Batch Manager (see issue #26 ).
While I move one directory to another I got error below. I thought this was error with permissions, but now permissions are OK, album under ./galleries moved correctly. Metada looks unchanged.
Warning: rename(./_data/i/./galleries/server_box,./_data/i/./galleries/misc/archive/server_box): No such file or directory in /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php on line 443
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(./_data/i/./galleries/misc/archive/server_box): failed to open dir: No such file or directory in /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php:547 Stack trace: #0 /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php(547): DirectoryIterator->__construct('./_data/i/./gal...') #1 /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php(444): ppm_chmod_r('./_data/i/./gal...') #2 /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php(82): ppm_move_album('93', '23', false) #3 /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/admin.php(69): ppm_move_item('93', '23', false, 'album') #4 /var/www/gallery.evadim.ru/htdocs/admin/plugin.php(68): include_once('/var/www/galler...') #5 /var/www/gallery.evadim.ru/htdocs/admin.php(311): include('/var/www/galler...') #6 {main} thrown in /var/www/gallery.evadim.ru/htdocs/plugins/physical_photo_move/include/functions.inc.php on line 547
The new data-selectize-based dropdown on the Batch Manager page in 2.10 allows for a nicer display and also allows for the user to type in the box to search (which is helpful in large galleries with lots of albums/sub-albums). However, there are a few issues I haven't been able to figure out yet:
the control will not default to empty, showing the placeholder text; instead it automatically selects the first album in the list
the albums are not properly sorted; in a View Source, they are listed in the correct order in the resulting HTML, but the control is apparently sorting them by "value" instead:
I had an album, Chris/Blah2015 which had a a bunch of subalbums, Chris/Blah2015/{22,23,24,25}Jun2015 . However, there were no pictures at the Chris/Blah2015 level. Going to the Move tab leads to an error:
Piwigo encountered an irrecoverable error
[get_image_infos] invalid image identifier
#1 get_image_infos /av/piwigo/plugins/physical_photo_move/admin.php(132)
#2 include_once /av/piwigo/admin/plugin.php(68)
#3 include /av/piwigo/admin.php(311)
Adding an image temporarily to Chris/Blah2015 allows the move operation to work
Can you add Piwigo-TranslationTeam user for autorise add language
If a photo is virtually linked into a physical album and you attempt to move the photo into that same physical album, the SQL update to the image_category table will fail with a unique constraint since the category_id for the image_id already exists:
Warning: [mysql error 1062] Duplicate entry '41-29' for key 'PRIMARY'
UPDATE image_category
SET category_id = '29'
WHERE image_id = '41' AND category_id = '8'
in /usr/local/piwigo-beta/include/dblayer/functions_mysqli.inc.php on line 845
Maybe I should just delete the existing row first?
It'd be nice to link this into Batch Manager (global mode) to allow multiple photos to be moved at once.
Hi,
I'll start with...Thanks for making this plugin! I put off rebuilding my albums because I knew I was going to have to (1) physically move folders around, and then (2) manually update the DB with the new folder numbers. Tonight I updated to the new version of Piwigo, and I decided to check out the list of plugins, and I saw Physical Photo Move...and it was just what I needed. I had my backups from before the piwigo update, so crossed my fingers and tried one album move. It went perfectly. No data was lost. In fact, nothing was lost. So I tried another, and tested again. All good. So I tried another...and another...and another...each time...everything looks good. So I kept rolling. And BAM. Error. The gallery is fine. All moved, and other un-moved albums are fine. The error I am hitting seems to be just with the plugin. And to your credit...no damage to the site, even though I am hitting an error. (Nice.)
I tried to check things here and there, but I wasn't able to find anything. I see what the code is doing on line 454, and it is pretty straightforward, and should work...and it did work...7 times before. I checked permissions, and even set everything in question to 777 just for fun. I am thinking I might have an "ownership" problem, but my host doesn't allow me to view owner. They do allow me to "take ownership", so I did that, and retired. Same error.
Let me know if you have any ideas.
Thanks for taking a look,
John
Warning: rename(./galleries/LanParties/FITES2012,./galleries/LanParties/FITES/FITES2012):
Permission denied in /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 454
Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(./galleries/LanParties/FITES/FITES2012): failed to open dir: No such file or directory in /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php:585 Stack trace: #0 /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php(585): DirectoryIterator->__construct('./galleries/Lan...') #1 /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php(455): ppm_chmod_r('./galleries/Lan...') #2 /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php(82): ppm_move_album('73', '69', false) #3 /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/admin.php(80): ppm_move_item('73', '69', false, 'album') #4 /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/a in /usr/local/4admin/apache/vhosts/njlanparty.com/httpdocs/apps/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 585
I typically move albums at the end of a year to a subalbum specific to that year. ie, A-2017, B-2017 gets moved to 2017/ at the end of the year. It would be helpful to be able to grab a bunch of albums at once and move them all in batch. However, it looks like piwigo doesn't currently have a facility for bulk operations on albums, so this is probably a long range wishlist item :)
If the user preferred language has not been translated yet, this extension will show the internal i18n tags, like DEST_ALBUM_HELP_2, MSG_RENAME_3, etc. While the variables are well-named and somewhat understandable, falling back to English would be a better choice in my opinion.
Since I've not read the code, one possible workaround is creating symbolic links to en_UK
. Any ideas for more decent solutions?
After moving an album, the first symptom was the lack of execute permissions:
$ ls -ld January2015
drw-r--r-- 1 www-data www-data 2.2K Jan 1 2016 January2015/
Potentially worth noting, previous to move, the file was owned by chris.www-data with 775 permissions. Having fixed permissions, the album will load but all of the pictures simply show an exclamation point indicating an error. There doesn't seem to be anything in the web server's error log. The access log looks reasonably normal I think, ie:
1.2.3.4 - - [01/Feb/2018:20:19:50 -0500] "GET /piwigo/i/galleries/Chris/2015/January2015/20150102_113318_Noelie_Will_Julia-me.jpg?ajaxload=true HTTP/1.1" 200 595 "https://www.hostname.com/piwigo/picture/36953-20150102_113318_noelie_will_julia/category/January2015" "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0"
None of the resizes of the picture work, however selecting the "Original" size does show the correct picture. I'm not sure where I should be looking for debugging information, any hints? Thanks for the work on this, it's a lifesaver!
Created a new, empty album (directory) and did a sync to get it loaded into Piwigo. Then tried to move a photo into the new album and the plugin failed trying to move the derivatives:
Warning: rename(./_data/i/./galleries/places/batch-test-01-20170612224306-cu_e260x180.jpg,./_data/i/./galleries/places/testing2/batch-test-01-20170612224306-cu_e260x180.jpg): No such file or directory in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 262
Warning: rename(./_data/i/./galleries/places/batch-test-01-20170612224306-sq.jpg,./_data/i/./galleries/places/testing2/batch-test-01-20170612224306-sq.jpg): No such file or directory in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 262
Warning: rename(./_data/i/./galleries/places/batch-test-01-20170612224306-th.jpg,./_data/i/./galleries/places/testing2/batch-test-01-20170612224306-th.jpg): No such file or directory in /usr/local/piwigo-beta/plugins/physical_photo_move/include/functions.inc.php on line 262
batch-test-01-20170612224306.jpg: An error occured during the representative/derivatives move. Please check the Piwigo and web server logs for details.
This was because the target directory for the derivatives doesn't exist yet. I forgot to include that code like I did when moving representatives.
A user reported the following error trying to access any page on his Piwigo site after activating the plugin:
Parse error: syntax error, unexpected '[' in /usr/local/piwigo/plugins/physical_photo_move/include/functions.inc.php on line 49
Line 49 of functions.inc.php should looks like this:
$source_cat_name = get_cat_info($storage_cat_id)['name'];
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.