i had an album named "sansemploi" (nevermind the name) within a "shows" album in gallery. the script couldn't find it. i've done a symlink to workaround the problem, but i think it's a bug.
that's without mentionning the fact it took me around an hour to figure out that the script was failing to copy the images because i didn't setup the images path properly... here's the patch i've applied to the script to debug it:
note the mkdir() && false to avoid panicing when the directory already exists, since i was testing over and over again.
@@ -40,7 +40,7 @@
* This must be the value after last slash.
* ex. if value is -> /home/httpd/html/gallery2/g2images then enter just -> gallery2
*/
-$galleryAlbPath = "g2images";
+$galleryAlbPath = "../g2data";
pageheader("Import Albums from Menalto Gallery2");
//We need to flush periodically, so output buffering disabled.
@@ -131,7 +131,7 @@
}
list($galAlbum, $albumName)= explode ('^', $_POST['galAlbum']);
- if (!@mkdir ($CONFIG['fullpath']."/".$albumName, 0777)) {
+ if (!@mkdir ($CONFIG['fullpath']."/".$albumName, 0777) && false) {
echo "<br />Unable to create album directory. Directory with the same name <b>".$CONFIG['fullpath'].$albumName."</b> already exists. Exiting ...<br />";
endtable();
pagefooter();
@@ -179,21 +179,25 @@
}
while ($row = mysql_fetch_array($result)) {
$itemid = $row["{$cp}id"];
- $imageFullName = $row["{$cp}pathComponent"];
- $imageTitle = $row["{$cp}title"];
- $imageCaption = $row["{$cp}description"];
+ $imageFullName = addslashes($row["{$cp}pathComponent"]);
+ $imageTitle = addslashes($row["{$cp}title"]);
+ $imageCaption = addslashes($row["{$cp}description"]);
$viewCount = $row["{$cp}viewCount"];
$source = "$galleryPath/$galleryAlbPath/albums/";
$source .= ($albumName != 'Base') ? "$albumName/" : '';
$source .= $imageFullName;
$target = $CONFIG['fullpath'].$albumName."/$imageFullName";
- //echo "<BR>IMAGE: SRC -> $source TGT -> $target<BR>";
+ echo "<BR>IMAGE: SRC -> $source TGT -> $target<BR>";
flush();
- @copy($source, $target);
+ if (!copy($source, $target)) {
+ echo "failed to copy $source to $target";
+ }
//Call add_picture
+ flush();
+
$result1 = add_picture ($aid, $albumName."/", $imageFullName, '', $imageTitle, $imageCaption, $imageKeywords, '', '', '', '', 0, $raw_ip, $hdr_ip, $viewCount);
if ($result1) {