Batch add/Browser Interface not working for "albums" Batch add/Browser Interface not working for "albums"
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Batch add/Browser Interface not working for "albums"

Started by cdawg, May 11, 2015, 07:31:26 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

cdawg

I've upgraded my gallery to 1.5.36 and come across something. 

When I batch add files and it starts from the "albums" folder, it doesn't seem to work properly and ends in a white page. 

Looking at the URL for the batch, it seems as if the "albums" portion of the URL is gone. 

The URL from the "Ok" Button when the base upload folder is called "Pics"

http://marsha-thomason.com/photos/searchnew.php?startdir=Pics/Television/SafeHouse/101

but when the base upload folder is "albums" that albums folder is missing from the URL

http://marsha-thomason.com/photos/searchnew.php?startdir=Season%20One

when you turn off the browser interface, you can batch from the "albums" folder. 

Any idea on how to get the batch to work properly? 

Joe Carver

What is the setting in Config >> File Settings >> The album directory ?

And, in case the issue might be from something else, and the problem isn't solved by resetting that value:

Please reply with the server settings for:

  • Server type / OS / Version
  • PHP version

And enable debug with notices (don't post the output) and take note of the notices only.


cdawg

Config >> File Settings >> The album directory (I have never changed that setting either)

albums/

(I have never changed that setting either)

Server Info

Apache Version   2.2.29
PHP Version   5.4.39
MySQL Version   5.5.42-cll
Architecture   x86_64
Operating System   linux


I don't get a notice with de-bug notice, it all works fine till the final screen of batch adding, and then it's a white screen

phill104

If possible take a look at the logs for when you get the white screen or enable full error reporting on your server. Depending on these settings, when a server crashes it will either display an error or simply a white screen. Knowing exactly what the error is will greatly help in diagnosis.
It is a mistake to think you can solve any major problems just with potatoes.

cdawg

I will take a look at the error log this evening.  I will say the batch add/browser interface works on the server like it should if your images are starting from anything but "albums" - the double use of that seems to not be recognized.

cdawg

nothing in the error log. 

The server settings have also remained at the memory_limit is set at 64M and upload_max_size is set at 8M - been that way since the days of 1.3

Joe Carver

#6
With no success in replicating the issue...

Please run versioncheck.php.

What is the folder structure where the files are located?

Is it cpg_root/albums/album_name/some_names.jpg?

Or something else?

If it is as above, try a different theme such as curve: http://marsha-thomason.com/photos/index.php?theme=curve
Your theme or wrapper might be conflicting with javascript that is part of the routine (searchnew.js).

The theme also looks to be in need of updating / editing for use with cpg 1.5x.

cdawg

Joe when you tried to replicate was it batching specifically from an albums folder?

For example I can batch properly when this is the patch

http://marsha-thomason.com/photos/albums/Pics/Television/SafeHouse/102/thumb_S1E2_00115.jpg

but when the path includes albums/albums like this

http://marsha-thomason.com/photos/albums/albums/SeasonOne/001.jpg

it created the white screen when trying to batch using browser interface.  I know of multiple sites across servers, and all have the same problem with batch add browser interface when the patch includes albums/albums

2.  Switched to Curve, same issues. 

3.  Ran version check, no php files effected. 

Joe Carver

I can confirm the effect with different results, all stopping batch uploads.

It will also occur if the sub-folder contains the "albums" folder name.
ex. ...albums/aaalbums, albums/new_albums, etc..

Time is short for me now, so I can only make suggestions.

  • Use another method, the HTML 5 upload plugin has great reviews, for example.
  • It might be possible to rename the folder and run a query to replace the value in the db Pictures table
  • [It might be possible to modify the code, but as with the suggestion above, I can't  be certain/li]


Αndré

Can anyone please test if this also happens with cpg1.5.34? Maybe I fixed too much in cpg1.5.36.

allvip

#10
Quote from: Αndré on May 29, 2015, 10:10:13 PM
Can anyone please test if this also happens with cpg1.5.34? Maybe I fixed too much in cpg1.5.36.


I have Apahe, PHP, cpg 1.5.34, cpg 1.5.36 on my PC. I have the same settings in Config - File settings for both copermine installations.


http://localhost/cpg15x/albums/albums/SeasonOne/001.jpg
http://localhost/cpg1536/albums/albums/SeasonOne/001.jpg


Not working in 1.5.36. Is working in 1.5.34. In both coppermine installations in the please select a directory box is not showing the path albums/albums/SeasonOne like it does for the Pics folder (albums/Pics/Television/SafeHouse/102/). See attachments. Even if is not showing the path in please select a directory box is working in 1.5.34.

I tryed again and again. The page takes a lot of time to load then error: blank page (http://localhost/cpg1536/searchnew.php?startdir=SeasonOne).

http://localhost/cpg15x/albums/Pics/Television/SafeHouse/102/S1E2_00115.jpg
http://localhost/cpg1536/albums/Pics/Television/SafeHouse/102/S1E2_00115.jpg

http://localhost/cpg15x/albums/test1 (336 files)
http://localhost/cpg15x/albums/test2 (same files + 001.jpg)

http://localhost/cpg1536/albums/test1 (336 files)
http://localhost/cpg1536/albums/test2 (same files + 001.jpg)

Works fine in both coppermine installations.

I dont't know why in other threads users say batch is not working: duplicate. For me it always worked fine. No duplicates issue. Not even when I had allvip.us gallery.



allvip


Αndré

minibrowser.php itself stops to display sub-directories in the complete path as soon as a directory with the name "album" is opened. E.g. I currently test with a path "cpg/albums/test123/albums/test321" and the minibrowser won't show more than "albums/test123/".

When I try to batch-add from the "test321" directory, the URL in the address bar is "searchnew.php?startdir=test123\test321", so "albums" has been stripped for some reason. I'll investigate further.

Αndré

Quote from: allvip on May 30, 2015, 09:00:43 PM
Maybe albums/albums is not a good ideea.
That doesn't matter. It's a bug I introduced. Please also have a look at Joe's and my replies, Coppermine currently replaces all occurrences of "*albums", regardless where in the path they occur.

However, I think I have a fix for this. Please open minibrowser.php, find
echo '<a href="'.$linktarget.'?startdir='.rtrim(str_replace($limitfolder, '',$folder), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;
and replace with
        function cpg_str_replace_first($search, $replace, $subject) {
            $pos = strpos($subject, $search);
            if ($pos !== false) {
                return substr_replace($subject, $replace, $pos, strlen($search));
            } else {
                return false;
            }
        }
        echo '<a href="'.$linktarget.'?startdir='.rtrim(cpg_str_replace_first($limitfolder, '', $folder), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;

(it may also work with a simple substr call, but I noticed that too late :P)

That should fix the batch-add functionality, but not the display of the current path (see my last reply). I'll have a closer look at that issue later.

Αndré

Quote from: Αndré on May 30, 2015, 09:54:01 PM
it may also work with a simple substr call

This should also work, please confirm:
echo '<a href="'.$linktarget.'?startdir='.rtrim(substr($folder, strlen($limitfolder)), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;

allvip

Quote from: Αndré on May 30, 2015, 09:54:01 PM
That doesn't matter. It's a bug I introduced. Please also have a look at Joe's and my replies, Coppermine currently replaces all occurrences of "*albums", regardless where in the path they occur.

However, I think I have a fix for this. Please open minibrowser.php, find
echo '<a href="'.$linktarget.'?startdir='.rtrim(str_replace($limitfolder, '',$folder), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;
and replace with
        function cpg_str_replace_first($search, $replace, $subject) {
            $pos = strpos($subject, $search);
            if ($pos !== false) {
                return substr_replace($subject, $replace, $pos, strlen($search));
            } else {
                return false;
            }
        }
        echo '<a href="'.$linktarget.'?startdir='.rtrim(cpg_str_replace_first($limitfolder, '', $folder), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;

(it may also work with a simple substr call, but I noticed that too late :P)

That should fix the batch-add functionality, but not the display of the current path (see my last reply). I'll have a closer look at that issue later.

Works even if is not  showing the path in please select a directory box.

allvip

Quote from: Αndré on May 30, 2015, 10:10:11 PM
This should also work, please confirm:
echo '<a href="'.$linktarget.'?startdir='.rtrim(substr($folder, strlen($limitfolder)), $folder_sep).'" class="admin_menu" target="_parent">'.cpg_fetch_icon('ok', 2) . $lang_common['ok'].'</a>' . $newline;

Works even if is still not showing the path in please select a directory box.
Better this solution. Is shorter then the one from reply Reply #13.

Αndré