[cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
 

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

[cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter

Started by Aditya Mooley, March 21, 2008, 07:17:18 AM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Aditya Mooley

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

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.  :)
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

nickjo

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

Aditya Mooley

You don't have to pay me for it. But if you really want to ... consider donating to SourceForge or a charity of your choice. :)
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

joedavis

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

joedavis

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

Aditya Mooley

hmmm, I have this habit of forgetting to escape the quotes. Corrected now. Should work.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

fatesjoke03

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.

fatesjoke03

Nevermind, I see I didn't read enough. Instructions are in the txt file as to how to configure, sorry kinda new at this.

j3cubcapt1

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

Aditya Mooley

It should pull all albums and pictures at one time. Let us know if it works for you.

All the best.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

j3cubcapt1

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

j3cubcapt1

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



Aditya Mooley

Quote
1. There is no INSTALL folder, should I create one?

No need to create any folder. Put the file where you have installed Coppermine.

Quote
2. Why do I have to be logged in as the ADMIN?

Since normal users should not be able to use this feature.

Quote
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.
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

j3cubcapt1

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

Aditya Mooley

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
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

j3cubcapt1

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

j3cubcapt1

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

Joachim Müller

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.

j3cubcapt1

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

SaWey

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');