Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2 3   Go Down

Author Topic: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter  (Read 51179 times)

0 Members and 1 Guest are viewing this topic.

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
[cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« 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

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

Code: [Select]
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

Code: [Select]
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

Code: [Select]
$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

Code: [Select]
$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.  :)
« Last Edit: May 19, 2009, 08:35:56 am by Aditya Mooley »
Logged
--- "Its Nice 2 BE Important but its more Important 2 Be NICE" ---
Follow Coppermine on Twitter

nickjo

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #1 on: March 21, 2008, 07:35:35 pm »

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
Logged

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #2 on: March 22, 2008, 06:49:06 am »

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

joedavis

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #3 on: April 03, 2008, 05:47:49 pm »

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
Logged

joedavis

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #4 on: April 03, 2008, 06:16:56 pm »

Well, I spoke too soon. The script doesn't want to import anything with apostrophe's. It fails with this message:

Code: [Select]
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
Logged

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #5 on: April 04, 2008, 08:05:46 am »

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

fatesjoke03

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #6 on: May 19, 2008, 06:14:16 pm »

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.
Logged

fatesjoke03

  • Coppermine newbie
  • Offline Offline
  • Posts: 12
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #7 on: May 19, 2008, 06:16:19 pm »

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

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #8 on: November 15, 2008, 12:56:32 am »

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
Logged

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #9 on: November 15, 2008, 11:13:47 am »

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

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

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #10 on: November 15, 2008, 11:26:46 pm »

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
Logged

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #11 on: November 17, 2008, 04:34:24 am »

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


Logged

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #12 on: November 17, 2008, 06:15:29 am »

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

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #13 on: November 17, 2008, 11:37:29 pm »

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
Logged

Aditya Mooley

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 781
    • My Sweet Home
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #14 on: November 18, 2008, 06:16:11 am »

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

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #15 on: November 19, 2008, 12:20:12 am »

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
Logged

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #16 on: November 21, 2008, 03:48:56 am »

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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #17 on: November 21, 2008, 09:38:50 am »

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.
Logged

j3cubcapt1

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #18 on: November 21, 2008, 09:47:15 am »

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
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: [cpg1.4.x]: Adv. Menalto Gallery To Coppermine Converter
« Reply #19 on: November 22, 2008, 08:55:57 pm »

Are you sure the paths on line 20 haven't been edited?
-->
Code: [Select]
require('include/init.inc.php');
require('include/picmgmt.inc.php');

If they are, try setting them to
Code: [Select]
require('/home/j3cub/public_html/coppermine/include/init.inc.php');
require('/home/j3cub/public_html/coppermine/include/picmgmt.inc.php');

Logged
Pages: [1] 2 3   Go Up
 

Page created in 0.035 seconds with 20 queries.