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]   Go Down

Author Topic: Possible Xml output solution for your flash.  (Read 11356 times)

0 Members and 1 Guest are viewing this topic.

Garry2k8

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Possible Xml output solution for your flash.
« on: June 02, 2008, 08:45:23 pm »

Xml output code script

Just playing around with this piece of code and its works well for my needs.
The base code is from the flow_link.php script.
I have only changed some codes and added the output code.

Code: [Select]
$plFile = "temp/photos.xml";
@unlink($plFile);
$handle = fopen ($plFile, "w");
fwrite($handle,$xml);
fclose($handle);

So I thought, maybe there are more who want to play with this code.
You must create/edit it to your own flash xml needs.
So, if your flash reads only image and link from an xml file, you must remove some instructions.

The Script,
Code: [Select]
<?php
define
('IN_COPPERMINE'true);
define('INDEX_PHP'true);
require(
'include/init.inc.php');
if (
IN_COPPERMINE) {
$path=$CONFIG['site_url'];
$xml '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
';
$xml .= '<images>';
} else {
$path = 'http://localhost/'; //change this to your specific path to make the output url's absolute with trailing slash
}
if ($FORBIDDEN_SET != "") $FORBIDDEN_SET = "AND $FORBIDDEN_SET";
$result = mysql_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']} AS p WHERE filename LIKE '%.jpg' ORDER BY pid DESC LIMIT 99");
$row = mysql_fetch_array($result);
while ($row = mysql_fetch_array($result))
{
$type = max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width'] ? 'thumb' : 'thumb';
$xml .= '<img image="' . $path . get_pic_url($row, $type) . '" title="' . $row['title'] . '" description="' . $row['caption'] . '" url="' . $path . "displayimage.php?pos=-" . $row['pid'] . '" window="' . _parent . '"/>';
}
$xml .= '</images>';

// Now that we've got the xml list, let's write it out to the disk
$plFile = "temp/photos.xml";
@unlink($plFile);
$handle = fopen ($plFile, "w");
fwrite($handle,$xml);
fclose($handle);
?>

The basic xml output without data looks like this.

Code: [Select]
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
        <img image="thumb_" title="" description="" url="" window="_parent"/>
</images>

Just place the script code in your gallery, name the php script something like xmloutput.php, create a temp dir in the same environment, (or edit the output temp/photos.xml to your wish) and go to your gallery site link /xmloutput.php
You see a white page, with no errors; check your temp dir for the xml output file.

Question, this is a manual solution, can it automatic?.
Answer, possible it can include somewhere near the users upload section, however I only bring this idea, and I have limited programming skills.

Question, I see no output file in my just made (temp) dir.
Answer, some host must have read/write access to the output map, and some must have the real path to the output map.
The output for the xml writing in this script is temp/photos.xml
Just adapt is to your needs.
In my case it works fine without write access and real path.

Question, I have the output xml file, however my flash cannot read from it.
Answer, you must edit the script to adapt to your own flash, also you must know where the flash looks for his xml file and what the xml filename is.
If you know the name of the output file and you have renamed the output xml file in the script and also you cannot edit the flash file for a path to, place it near the xml file.

Question, Your English ...
Answer, I know.

Logged
Pages: [1]   Go Up
 

Page created in 0.055 seconds with 20 queries.