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?
out of the box... no
Would it even be feasable to try to modify it to do that?
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.
Quote from: Stramm 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.
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:
<?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" />
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 (http://www.phpclasses.org/browse/file/17412.html) 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.
Thank you much! Looks like I have some work ahead of me! =)
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.
<?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.
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!
with some basic php/ mysql knowledge it shouldn't be hard at all
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:
<?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. :'(
<?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(">", ">", $row['text']);
$row['text'] = str_replace("\"", """, $row['text']);
$xml_output .= "\t\t<text>" . $row['text'] . "</text>\n";
$xml_output .= "\t</entry>\n";
}
$xml_output .= "</entries>";
echo $xml_output;
?>
OK, thread continues on the paid support section, in your new thread there (http://forum.coppermine-gallery.net/index.php?topic=49655.0). 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.