forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Convertors => Topic started by: Aditya Mooley on March 21, 2008, 07:17:18 am
-
Presenting the advanced Menalto Gallery to Coppermine converter.
Main features -
# Can import pictures from outside the webroot
# Can fetch sub-albums if asked to. (in other words you can now import whole gallery in single request)
# All the other features of the previous version (http://forum.coppermine-gallery.net/index.php/topic,21812.0.html)
I have tested this converter on Gallery 2.2.4 and CPG 1.4.16
Attaching a .txt file and a zip file with this post. If you prefer to download the .txt file please change the file extension to .php after downloading.
Place the file your coppermine install folder, make the changes as suggested in the comments and that's it.
You must login as ADMIN to be able to run this file.
Few below mentioned changed are needed in include/picmgmt.inc.php file in your coppermine install to use this mod. As usual, backup your original file before changing.
Find
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0)
And replace with
function add_picture($aid, $filepath, $filename, $position = 0, $title = '', $caption = '', $keywords = '', $user1 = '', $user2 = '', $user3 = '', $user4 = '', $category = 0, $raw_ip = '', $hdr_ip = '', $iwidth = 0, $iheight = 0, $hits = 0)
Find
$query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
And replace with
$query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, hits) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}', '$hits')";
Thats all. Happy Coppermining. :)
-
Aditya - Thank You! I will give it a try this weekend and let you know if I run into any issue(s). Do you have a paypal account? PM me if you do. Thanks! -Nick
;D
-
You don't have to pay me for it. But if you really want to ... consider donating to SourceForge (http://sourceforge.net/donate/) or a charity of your choice. :)
-
Thanks for this!! You really made my switch from G2 so easy.
You may want to check the import_gallery2.txt file. I think that last 10 lines or so are missing from it.
Thanks,
Joe
-
Well, I spoke too soon. The script doesn't want to import anything with apostrophe's. It fails with this message:
There was an error while processing a database query.
While executing query "INSERT INTO cpg14x_pictures (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, hits) VALUES ('38', 'Baby/', 'Baby_s first picture.jpg', '319158', '341652', '1183', '907', '1207239314', '1', 'joedavis','Baby's first picture', '', '', 'YES', '', '', '', '', '70.252.146.178', '70.252.146.178', '', '0')" on 0
mySQL error:
There isn't anything after the mySQL error:.
Thanks,
Joe
-
hmmm, I have this habit of forgetting to escape the quotes. Corrected now. Should work.
-
Followed the instructions and I am getting this error "Could not connect to database: MySQL Said: " nothing more. Not sure what other info you may need. Let me know. Thanks.
-
Nevermind, I see I didn't read enough. Instructions are in the txt file as to how to configure, sorry kinda new at this.
-
Stupid question, I really want to dump Gallery2 and import all 650+ albums to Coppermine. Will this pull all of the albums and pictures at one time, or do I have to re-edit this for each album?
Thanks
Will
-
It should pull all albums and pictures at one time. Let us know if it works for you.
All the best.
-
Thanks Aditya, I am fairly new at this. When you say... "make the changes as suggested in the comments" are those the comments in Green? I have about 600+ albums and sub albums to transfer.
Will
-
OK, a couple of questions...
1. There is no INSTALL folder, should I create one?
2. Why do I have to be logged in as the ADMIN?
3. Do I just browse to the file when I ready to start the conversation?
Thanks
Will
-
1. There is no INSTALL folder, should I create one?
No need to create any folder. Put the file where you have installed Coppermine.
2. Why do I have to be logged in as the ADMIN?
Since normal users should not be able to use this feature.
3. Do I just browse to the file when I ready to start the conversation?
You don't have to browse to the file. You just have to select the album from the list that you want to import. You will see the instructions once you open the script in browser.
-
First, thank you so much for your answers, but I am really not getting how to make this happen.
I have made the necessary changes and uploaded the file to the coppermine folder, but what is the next step to make this conversion to start? Will I see some thing in the CONFIG section of Coppermine's admin panel?
Will
-
Make sure that the file extension is .php.
Make the necessary changes to the file and upload the file to coppermine folder and run the file by typing the URL in browser like -> http://your-domain/cpg-folder/import_gallery2.php
-
OK, I followed your instructions but got this error....
Warning: main(/home/j3cub/public_html/gallery/include/init.inc.php) [function.main]: failed to open stream: No such file or directory in /home/j3cub/public_html/coppermine/import_gallery2.php on line 20
Warning: main(/home/j3cub/public_html/gallery/include/init.inc.php) [function.main]: failed to open stream: No such file or directory in /home/j3cub/public_html/coppermine/import_gallery2.php on line 20
Fatal error: main() [function.require]: Failed opening required '/home/j3cub/public_html/gallery/include/init.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/j3cub/public_html/coppermine/import_gallery2.php on line 20
-
I changed line 20 of the install_gallery2.php "$galleryAlbPath" to my gallery path, but why is the script looking there for the ('include/init.inc.php') & ('include/picmgmt.inc.php')?
I'm really not that smart with this stuff, but have I typed something wrong?
Thank you in advance for your help!
Will
-
I think you're mixing things up: you need to install coppermine first. Then you use the converter from coppermine and point it to your Menalto gallery. You appear to have uploaded the converter into the Menalto gallery - this will not work. Please review instructions carefully.
-
Joachim, I thank you for your assistance. I do indeed have Coppermine installed and the converter loaded into that directory, but the error listed above seems to indicate that the converter is looking for the ('include/init.inc.php') & ('include/picmgmt.inc.php') files in the "GALLERY" directory and not where they are located which is in the "COPPERMINE" directory.
Will
-
Are you sure the paths on line 20 haven't been edited?
-->
require('include/init.inc.php');
require('include/picmgmt.inc.php');
If they are, try setting them to
require('/home/j3cub/public_html/coppermine/include/init.inc.php');
require('/home/j3cub/public_html/coppermine/include/picmgmt.inc.php');
-
Ding, Ding, Ding, we have a winner!!! Thanks SaWey!
That was it, I have it working now...I really like it converter, although I had sub-albums that were brought over outside of their parent albums, oh well, I guess there is a way for me to re package them again!
Thanks again SaWey!
Will
-
i am having a problem with this script..
i have all the info set up correctly, but when i go to do an import, it makes the directory, but fails to insert the file.. here's part of the log..
Array ( [14] => Array ( [name] => 02.29.08 [gallery_path] => /022908 [cpg_alb] => 022908 ) )
Directory 022908 for album 02.29.08 created
Album created
Importing images ...
Unable to insert file IMG_2614.JPG. Skipping...
Unable to insert file IMG_2616.JPG. Skipping...
Unable to insert file IMG_2497.JPG. Skipping...
so on and so forth for every picture.. then at the end i get:
Unable to insert file projekt-collage.jpg. Skipping...
Successfully imported album 02.29.08 from Gallery2 to Coppermine
any idea what's going on?
-
Any idea how to get it to work with utf-8? At the start it asks to select albums, the names are like ??????? ???? ??????
The same database works fine with gallery 2.
Thanks
-
From reading the script, it appears to me that both gallery2 and coppermine must be on the same server. We are setting up a new web site/domain and have clean installs of all of our software. If I assume correctly that both gallery2 and coppermine need to be on the same server, how hard would it be to tweak the script to pull the photos from another server? Or, would I need to install coppermine on the old server, then convert the g2 to coppermine, then migrate the data to the new server? Any help would be appreciated. Thanks, Rich
-
how hard would it be to tweak the script to pull the photos from another server?
I don't think importing will be possible when two galleries are on different servers. So, the only option is to import the photos to Copperemine on old server and then migrate CPG to new server.
-
Hey that mod is simply awesome...was amazing to watch and see all the "green messages" saying pics were imported.
Thanks again, Simple Great Work ;)
Regards
Roger
-
As kad123 I also got problems with the character set. Both my Gallery2 and Coppermine installations use UTF-8. When I try to convert I get problems with the Norwegian letters æøå / ÆØÅ. I get some strange characters.
I tried to change the character settings in Coppermine to ISO-8859-1. This gave Norwegian characters in the imported albums, but now I got problems with Norwegian characters in menus and albums manually made.
Hopefully someone has a solution?
Bjørn Roger Rasmussen, Norway - http://www.brr.no/
-
Don't! Don't switch Coppermine to any other, proprietary encoding like iso8859-1. Keep utf-8!
-
I second this .. I have the same trouble it just imports the albums and not the pics? is it perms setting on the albums folder? or its not fetching the data properly?
Any insights?
\Nitin/
i am having a problem with this script..
i have all the info set up correctly, but when i go to do an import, it makes the directory, but fails to insert the file.. here's part of the log..
so on and so forth for every picture.. then at the end i get:
any idea what's going on?
-
Thanks for an excellent convertor Aditya
It all seems to have worked fine with my Gallery 2.3 conversion to to cpg 1.4.20
-
It all seems to have worked fine with my Gallery 2.3 conversion to to cpg 1.4.20
Thanks for your report. Any particular reason for using the outdated cpg1.4.20 and not the currently supported stable release cpg1.4.21?
-
Hi Joachim,
The reason for using CPG 1.4.20 is simply because it is the most up to date version available from my web hosting company at the moment, for a first look at Coppermine I used their Fantastico installation for speed, if Coppermine is as good at it appears to be, I will most certainly remove that installation and manually install the most recent version, I will also include the Coppermine DB tables in my main database rather than, as with most Fantastico Installations in a separate database.
For reference Cpg is located at www.euadvantage.com/cpm and as stated before, my old Gallery for now is still available at www.euadvantage.com/gallery2
Thanks again for your and Phill's help with this, I will, no doubt, have a few more newbie questions when I become more familiar with Cpg, probably to do with integration into my site etc.
Jon
-
Hi, I am sorry if I have hujacked your thread, but I'm having problems with the mod. I have installed it, and it does work, but my problem is, I have users on my gallery, that I'm converting pictures from their Galleries on Gallery2 to Coppermine. The actual ftp'ing with this tool, works really quickly, but it puts all the pictures into the albums folder, and I cannot transfer them to the users galleries. Does anybody know how I can transfer the pictures over from the album folder to the individual users gallery?
Thank you.
John
-
Don't spread your identical issues over multiple threads. You already have an open thread (http://forum.coppermine-gallery.net/index.php/topic,59165.0.html) on this issue, don't double-post nor cross-post!
-
Problem with conversion.
-----------------------
File: C:\Inetpub\wwwroot\coppermine\cpg14x\include\functions.inc.php - Line: 250
While executing query "INSERT INTO cpg14x_pictures
(aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position, hits) VALUES
('16', 'xxxx/', 'DSC02040.JPG', '51231', '74409', '640', '480', '1242683987', '1', 'user','Gallery Admin during a more sober moment', '', '', 'YES', '', '', '', '', '127.0.0.1', '127.0.0.1', '', '0')" on 0
mySQL error:
-------------------------------
When I execute the above query into MySql it presents this message
----------
Incorrect integer value: '' for column 'position' at row 1
---------
I corrected this by not having '' (NULL) in the 'position' value but replacing with 0. This may be an issue starting with mysql 5.
This added the photo.
I have not investigated script that caused this.
However, I would like to get the converter to add all user information and credentials. How do I do this?
Very new to Coppermine as my hosting compnay is complaining Gallery2 uses too many Php cycles!
-
@kclem - Thanks for reporting the SQL error. Updated the converter accordingly.
However, I would like to get the converter to add all user information and credentials. How do I do this?
Currently there is no way to do this. The converter can just fetch the albums, photo and its comments.
-
I second this .. I have the same trouble it just imports the albums and not the pics? is it perms setting on the albums folder? or its not fetching the data properly?
Any insights?
\Nitin/
I've got the same problem as the other 2 guys further up; albums created but no pictures transferred.
The script also does not recreate the nesting of albums from Gallery2; and I think has problems with albums that have the same title. Is there a way to alter the script to name albums with their gallerry2 unique names?
Additionally; in my gallery config file I have $storeConfig['type'] = 'mysqlt'; having this in the import_gallery2.php file caused an error saying only mysql was supported; so I changed it back to $storeConfig['type'] = 'mysql'; could this be an issue?
-
Hi,
I've got a problem, I'm corverting Gallery2 to the last coppermine, but my gallery is very large, approx 42000 photos. The script made a timeout error after importing 6 albums and 50 photos...
The memory per script is 64 mb
There is a solution?
thanks
Luca
-
Hi,
I've got a problem, I'm corverting Gallery2 to the last coppermine, but my gallery is very large, approx 42000 photos. The script made a timeout error after importing 6 albums and 50 photos...
The memory per script is 64 mb
There is a solution?
thanks
Luca
-
Well, no perfect answer for this as I never had a chance to test the script with so many photos. But it should obviously not fail after 50 photos. Try importing a single album with maximum number of photos and see what happens.
-
It's work for gallery up to 45-50 pics
After that the server goes time out.
I think that with a scripting restart every 45 pics it can works.
I can't import my gallery...
-
Can you paste the last few messages displayed on your browser before the server timeout?
-
Hi. I see this thread got a little stale but I'm in the same position as the folks who are having the
Album created
Importing images ...
Unable to insert file pic1.JPG. Skipping...
Unable to insert file pic2.JPG. Skipping...
Problem. I have a rather large album so I started from scratch and tried to import just a small, individual album but get the same error. I wonder if this is the problem:
In my config file for Gallery my SQL Type is this:
$storeConfig['type'] = 'mysqlt';
when I ran initially the G2 Importer I got a SQL DB only message and so I tried to cheat by removing the 't' from the "type". I presume this is causing the problem. I'm not sure I understand what the 't' means in the $storeConfig['type'] setting.
Thanks for any help!
JPO
-
Yep; exactly the same for me; would be really good to find a workaround for this; as re-uploading all the photos from my Gallery2 will take absolutely ages.
Would also be good to work out how to maintain the album nesting from Gallery.
Cheers
Nicko
-
@JPO - PM me the FTP details of your site and I will try to find out the problem whenever I get time.
-
Did anyone have any luck with this?
-
Not really. JPO never sent me complete details to check the exact problem. For me, everything is still running correctly on my local testbed. So, can't really tell the problem unless I get to see/debug the issue where it is occuring.
-
just wanted to drop a line to let you know that the converter worked for me and saved just a ton of work (approx 3500 photographs)! Thank You.
Two small enhancement you might like to consider.
Convert to Categories (On or Off) - If an album has embedded albums then it might make sense to convert the top level to a Coppermine Category and automatically assign it's sub-albums to it. This would mimic the hierarchy in Gallery2.
The chances are this would only be run on a brand new installation.
Use gallery2 picture sizes (On or Off) - This would look at the theme settings for picture size and use those for thumbs / intermediate and full size.
That said. This really cut down on my work to do.
Once again, thank you.
Nigel.
-
Aditya, could you tell me what details you will need form me in order to access my system to try and work out this probelm; I'll provide them via PM and than hopefully we can get a solution to the problems that a few of us are having.
Thanks
Nicko
-
Thanks for this! Just used it to go from Gallery 2.3 to Coppermine 1.4.25 with no trouble. FYI, My gallery was installed via Fantastico and had a DB type of 'mysqlt' - afte removing the T, it worked great!
-
Hopefully this is the correct place to ask this question, forgive me if it isn't.
Will there be a ver 1.5x converter from Gallery2 ?
I tried to run this one, and it does show me the galleries from the database, but does nothing when you click import.
Thanks
-
Hello,
Yes, this is the right place to ask. I haven't tested the converter with cpg 1.5 yet. Will try to do that soon and come up with a working version.
Thanks.
-
I am wondering if any further work has been done with a 1.5 converter? I am a recent convert to Coppermine, with a lot of data in old Gallery2 databases, and this project is exactly what I need. Thanks for the hard work!
-
Good afternoon. When I try to import albums in Russian from Gallery2, a window appears with a list of albums with the characters ??? instead of names. The problem with the encoding, as I understand. How can I fix it?