|
#1
|
|||
|
|||
|
Copy folder doesn't work (for me)
it seems it generates a wrong filename, e.g.
Code:
file-name:2005-04-13 16:16:01_tronchi_valdifiemme2.jpg |
|
#2
|
||||
|
||||
|
I would check this later tonight, I'm very tired right now. BTW, what is you php and mysql version.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
|
#4
|
||||
|
||||
|
sorry there is a serious bug there!
line 55 of copy_folder.php addon Code:
$datetime = date("Y-m-d H:i:$secondcount");
1- it does not consider the timezone offset! 2- it uses ':' inside the timestamp! I dont underestand why it remained this way! use this php codes instead of the codes in that addon (replace the text inside the addon with this!) Code:
<?php /* Pixelpost version 1.4 Copy Folder Addon version 0.7 Pixelpost www: http://www.pixelpost.org/ Version 1.4: Developer Team: Ramin Mehran, Connie Mueller-Goedecke and Robert Prouse Version 1.1 to Version 1.3: Linus Contact: pixelpost@pixelpunk.se Copyright (c) 2004 shapestyle graphic design + code<http://www.shapestyle.se> License: http://www.gnu.org/copyleft/gpl.html This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ $copyfolderpath = ereg_replace("/images","",$cfgrow['imagepath']); if( isset($_POST['folder_path']) && isset($_POST['copyfolder']) ) { $filenumber = 0; $upload_dir = $cfgrow['imagepath']; $folder = $_POST['folder_path']; $folder = "$folder/"; $folder = ereg_replace("//","/",$folder); $secondcount = 0; $query = "select id from ".$pixelpost_db_prefix."categories order by id asc limit 0,1"; $catid = mysql_query($query); $catid = mysql_fetch_array($catid); $category = $catid['id']; $tz = $cfgrow['timezone']; if($addon_handle = opendir($folder)) { while (false !== ($file = readdir($addon_handle))) { if($file != "." && $file != ".." && $file != ".DS_Store") { if($secondcount < 11) { $secondcount = "0$secondcount"; } $datetime = gmdate("YmdHis",time()+(3600 * $tz)) .$secondcount; $secondcount++; // prepare the file $oldfile = $file; $newfile = "{$datetime}_$file"; $newpath = "$upload_dir$newfile"; $file = "$folder$file"; if(copy($file,$newpath)) { $filenumber++; // insert post in mysql - supports new multi-category table in ver 1.4 $query = "insert into ".$pixelpost_db_prefix."pixelpost(id,datetime,headline,body,image,category) VALUES('','$datetime','$oldfile','','$newfile','$category')"; $result = mysql_query($query) || die("Error: ".mysql_error()); // get new image ID $imagerow = sql_array("SELECT id, category FROM ".$pixelpost_db_prefix."pixelpost where image='$newfile'"); $id = $imagerow['id']; $category = $imagerow['category']; $query ="insert into ".$pixelpost_db_prefix."catassoc(id,cat_id,image_id) VALUES('NULL','$category','$id')"; $result = mysql_query($query) || die("Error: ".mysql_error()); } // if copy done } // if file done } // while false done closedir($addon_handle); } // if addon_handle done $message = "<hr><b>Copied $filenumber files.</b><br /> No thumbnails are created while copying files with this addon. Re-generate them by clicking the button below. <form method='post' action='$PHP_SELF?view=options&amp;optaction=updatethumbnails' accept-charset='UTF-8'> <input type='submit' value='Re-generate thumbnails' /> </form>"; } $addon_name = "Pixelpost Copy Folder Contents"; $addon_description = "Copy the entire contents of a folder into pixelpost database.<br /> Each entry will have the filename as title and and the first category (default) as category.<br /> <i>No thumbnails will be created.</i> You will have to come back to admin and update your thumbnails. <p /> Enter the absolute path to folder:<p /> <form method='post' action='index.php?view=addons' accept-charset='UTF-8'> <input type='hidden' name='copyfolder' value='1'> <input type='text' name='folder_path' value='$copyfolderpath' style='width:400px'><p /> <input type='submit' value='Copy Folder'> </form> $message"; $addon_version = "0.7"; ?> UPDATE: THE ABOVE CODE IS UPDATED ONCE. PLEASE MAKE SURE THAT YOU HAVE THE RIGHT VERSION THAT IF YOU READ THIS THREAD BEFORE THIS NOTE.
__________________
Photoblog: http://pblog.raminia.com Powered by Pixelpost 1.7 |
|
#5
|
|||
|
|||
|
It's repaired, the download-version is with the corrected copy-folder-addon now
|
| Thread Closed |
| Thread Tools | |
|
|