Advanced search  

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

Pages: [1]   Go Down

Author Topic: Coppermine pull photos from XML?  (Read 6093 times)

0 Members and 1 Guest are viewing this topic.

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Coppermine pull photos from XML?
« on: December 18, 2007, 08:25:47 am »

I have a flash gallery in place that generates a XML file to pull categories, photos, descriptions, etc.   Is is possible to have coppermine read this XML file and load the photos, categories, etc. from it, instead of having to load them into both systems?
« Last Edit: January 11, 2008, 08:15:31 am by Joachim Müller »
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Coppermine pull photos from XML?
« Reply #1 on: December 18, 2007, 08:33:56 am »

out of the box... no

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: Coppermine pull photos from XML?
« Reply #2 on: December 18, 2007, 08:51:50 am »

Would it even be feasable to try to modify it to do that?
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Coppermine pull photos from XML?
« Reply #3 on: December 18, 2007, 08:56:22 am »

If you want to use the list to import the images into your coppermine gallery it should be possible without to much work. If you want to use your flash gallery as base gallery and coppermine shall use instead of its own db the XML file of your other gallery, then I'd say you've a lot of work to do.

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: Coppermine pull photos from XML?
« Reply #4 on: December 18, 2007, 09:03:10 am »

If you want to use the list to import the images into your coppermine gallery it should be possible without to much work. If you want to use your flash gallery as base gallery and coppermine shall use instead of its own db the XML file of your other gallery, then I'd say you've a lot of work to do.

Hmm, I was afraid you were going to say that. I was hoping to do it the second way you mentioned, but the first way would work fine too. Any chance you could point me in the right direction to use the XML list to import the images into the coppermine DB?

Not sure if this will make a big difference, but this is what a section of the xml looks like:

Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
- <albums>
  <id type="gall" value="6" />
- <gallery id="1" name="ANIMALS" path="gallery/1/">
  <id type="img" value="12" />
  <image id="1" thumbnail="1s.jpg" pic="1.jpg" name="1" description="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." def="1" />
  <image id="2" thumbnail="2s.jpg" pic="2.jpg" name="2" description="Donec at metus quis neque pulvinar convallis. Nulla ante purus, ornare id, fringilla at, tincidunt eget, libero." def="0" />
  <image id="3" thumbnail="3s.jpg" pic="3.jpg" name="3" description="Mauris ut sem eget tortor adipiscing facilisis. Etiam a massa. Vestibulum eleifend convallis tellus." def="0" />
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Coppermine pull photos from XML?
« Reply #5 on: December 18, 2007, 09:06:58 am »

You'll need an XML library that read the xml file and converts the data into an array. Cpg1.5.x will be using lib.xml.php for that purpose. I suggest using searchnew.php as a base, integrate the xml library there and then start processing the data from the xml file.
Logged

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: Coppermine pull photos from XML?
« Reply #6 on: December 18, 2007, 09:08:42 am »

Thank you much! Looks like I have some work ahead of me! =)
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: Coppermine pull photos from XML?
« Reply #7 on: January 09, 2008, 07:14:35 am »

Okay, so I thought of another way. If I used coppermine as the main gallery (uploading, making categories, etc.) how hard would it be to write a php script that would use the coppermine db to create an xml page with this format? I have no problem running the php file manually every time I make a change as I only do updates about once a month.

Code: [Select]
<?xml version="1.0" encoding="utf-8" ?>
- <albums>
  <id type="gall" value="6" />
- <gallery id="1" name="ANIMALS" path="gallery/1/">
  <id type="img" value="12" />
  <image id="1" thumbnail="1s.jpg" pic="1.jpg" name="1" description="Lorem ipsum dolor sit amet, consectetuer adipiscing elit." def="1" />
  <image id="2" thumbnail="2s.jpg" pic="2.jpg" name="2" description="Donec at metus quis neque pulvinar convallis. Nulla ante purus, ornare id, fringilla at, tincidunt eget, libero." def="0" />
  <image id="3" thumbnail="3s.jpg" pic="3.jpg" name="3" description="Mauris ut sem eget tortor adipiscing facilisis. Etiam a massa. Vestibulum eleifend convallis tellus." def="0" />


This is what I currently have in my flash file to pull the xml file, but I don't think flash can connect to db's.
Code: [Select]
var gallMenuNames:Array = new Array();

var xml:XML = new XML();
xml.ignoreWhite = true;

xml.onLoad = function(ok:Boolean){
if (ok){
var temp:Array = _root.xml.childNodes[0].childNodes;

for (i=1; i<temp.length; i++){
gallMenuNames.push(temp[i].attributes.name);
}
}
}

xml.load("cgal.xml");


Any help would be greatly appriciated on this one. I know only enough php to get me into trouble, and dont know the coppermine db at all.    ???  I know it is asking for a lot but it would be greatly appriciated!
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Coppermine pull photos from XML?
« Reply #8 on: January 09, 2008, 09:32:43 am »

with some basic php/ mysql knowledge it shouldn't be hard at all

fareforce

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 66
  • Who are you calling a weasel?
    • Alaska Studio
Re: Coppermine pull photos from XML?
« Reply #9 on: January 11, 2008, 05:56:58 am »

I have posted this in the paid/freelance section as I dont know enough about php/mysql to do this, and I need it done very soon.  I have tried, and the closest I can get the php to generate is:

Code: [Select]
<?xml version="1.0" ?>
- <entries>
- <entry>
  <date />
  <text />
  </entry>
- <entry>
  <date />
  <text />
  </entry>
  </entries>


Here is the code I used, but I can't get it to display any of the actual data.   :'(

Code: [Select]
<?php 

header
("Content-type: text/xml"); 

$host "host"
$user "user"
$pass "password"
$database "db_name"

$linkID mysql_connect($host$user$pass) or die("Could not connect to host."); 
mysql_select_db($database$linkID) or die("Could not find database."); 

$query "SELECT * FROM cpg_categories GROUP BY name"
$resultID mysql_query($query$linkID) or die("Data not found."); 

$xml_output "<?xml version=\"1.0\"?>
\n";
$xml_output .= "<entries>\n";

for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);
    $xml_output .= "\t<entry>\n";
    $xml_output .= "\t\t<date>" . $row['date'] . "</date>\n";
        // Escaping illegal characters
        $row['text'] = str_replace("&", "&", $row['text']);
        $row['text'] = str_replace("<", "<", $row['text']);
        $row['text'] = str_replace(">", "&gt;", $row['text']);
        $row['text'] = str_replace("\"", "&quot;", $row['text']);
    $xml_output .= "\t\t<text>" . $row['text'] . "</text>\n";
    $xml_output .= "\t</entry>\n";
}

$xml_output .= "</entries>";

echo $xml_output;

?>
Logged
~fareforce
Anchorage, AK
Home of the frozen weasel
http://www.alaskastudio.com

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Coppermine pull photos from XML?
« Reply #10 on: January 11, 2008, 08:15:18 am »

OK, thread continues on the paid support section, in your new thread there. Marking this one as closed.
In the future, if you decide that you need a thread continued on the paid support board, just let us know by replying accordingly - a moderator will then move your thread accordingly, which keeps the board less cluttered.
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.