Hi,
couldn't find where to post this, maybe an admin could move it later on to a better-fit place.
I have created a simple script, which converts image.module's database into Plasmado-galleries database format. It's really a dirty-style of coding, with a lot of fixed-path/variables. If someone likes to show their Drupal-galleries with a flash front-end -with no Drupal rendering at all- here is the converter script. I placed it directly into galleries/ where i have the content of my galleries as a subfolder. Also Plasmado's files have been put into gallery/ and the converter script run as a crontab.
Plasmado can be downloaded at http://www.plasmado.com
A Democan be viewed at http://www.elastikv2.org/gallery/index.php
It's not a total solution, take it only if you know what to do and know php a bit, to edit it to your needs.
// Drupal2Plasmado converter
// by Cem Gencer, obsesif@gmail.com
//
// Converts database of a Drupal-gallery into Plasmado table
// $termo needs to be changed, reflecting the vocabulary id of your image gallery.
// $sizzle should be a resolution, which YOUR gallery has enabled
// on line 71 i also sue a fixed path, so you need to experiment with it to fir your configuration
// or even remove the str_replace comamnd with a simple
// $file=$details[$sizzle]['fname'];
include_once("config.php");
$termo=5; // vocabulary id of the image-gallery
$sizzle="300x400";
$groupId=0;
function doSQL($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
mysql_query("TRUNCATE TABLE plasmado");
$sql1="SELECT * FROM term_hierarchy INNER JOIN term_data ON (term_hierarchy.tid = term_data.tid) WHERE (term_data.vid = 5) AND (term_hierarchy.parent = 0)";
$res1=mysql_query($sql1);
while ($row1=mysql_fetch_object($res1)) {
$sql2=sprintf("insert into plasmado values ('',0,%s,'','','','')",doSQL($row1->name,'text'));
echo($row1->name);
$result=mysql_query($sql2) or die(mysql_error());
}
$sql3="SELECT * FROM term_hierarchy INNER JOIN term_data ON (term_hierarchy.tid = term_data.tid) WHERE (term_data.vid = 5) AND (term_hierarchy.parent <> 0)";
$res3=mysql_query($sql3);
while ($row3=mysql_fetch_object($res3)) {
$sql8="select * from term_data where tid=".$row3->parent;
$res8=mysql_query($sql8);
$row8=mysql_fetch_object($res8);
$sql4="select * from plasmado where title='".$row8->name."'";
$res4=mysql_query($sql4);
$row4=mysql_fetch_object($res4);
$sql9="insert into plasmado values ('',".$row4->id.",'".$row3->name."','','','','')";
$res9=mysql_query($sql9) or die(mysql_error());
}
$sql5="SELECT * FROM image INNER JOIN node ON (image.nid = node.nid) INNER JOIN term_node ON (node.nid = term_node.nid) INNER JOIN term_data ON (term_node.tid = term_data.tid) WHERE (node.`type` = 'image') AND (node.`status` = 1) AND (node.`type` = 'image') AND (term_data.vid = 5) ORDER BY term_data.weight, term_data.name, node.nid";
$res5=mysql_query($sql5);
$cnt=1;
while ($row5=mysql_fetch_object($res5)) {
$sql6="select * from plasmado where title='".$row5->name."'";
$sub6=mysql_query($sql6);
$row6=mysql_fetch_object($sub6);
$groupId=$row6->id;
$name=$row5->title;
$details=unserialize($row5->image_list);
$file=str_replace("gallery/","",$details[$sizzle]['fname']);
$info=strip_tags($row6->body);
if(file_exists($file)){
list($width, $height)=getimagesize($file);
$sql7 = "insert into plasmado values ('',$groupId,'$name','$file',$width,$height,'$info')";
$res7 = mysql_query($sql7);
}
}
** I (Bèr KEssels) edited this post, removed the pre tags, to show PHP highlighting. **