Look at potential 'Mod' script Look at potential 'Mod' script
 

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

Main Menu

Look at potential 'Mod' script

Started by rphMedia, November 22, 2004, 02:56:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rphMedia

Can I get a couple sets of eyes to look at this and let me know if it would cause any trouble before I post it as a Mod? It's working perfect at my site, but I just want some pros to look at it and let me know if it's 'error free' or "this could cause problems if..." type thing.  I have CPG ver 1.3.2 and I have no special settings changed. Paths are based on 'albums/userpics/blah'.

It builds an xml file for a Flash slideshow and can be used anywhere in the gallery - fullscreen down to a thumbnail.  Pulls out titles, and can be totally customized (random, desc, asc, normal_, full, thumb_, as many pics as you want to pull out, etc.....). This particular will pull out the last 5 pic uploads - Sample output attached.


<?
define('IN_COPPERMINE', true);
require('include/init.inc.php');
$xml .= '<?xml version="1.0" encoding="UTF-8" ?>';
$xml .= '<slideshow><settings><image_folder></image_folder><time>3</time><fade>1</fade><repeat>true</repeat><captions>true</captions></settings><images>';
$result = mysql_query("SELECT a.pid, a.aid, a.filename, a.filepath, a.pwidth, a.pheight, a.title, a.caption, b.title atitle from {$CONFIG['TABLE_PICTURES']} a, {$CONFIG['TABLE_ALBUMS']} b where a.aid = b.aid AND filename LIKE '%.jpg' order by a.aid, a.pid desc LIMIT 5");
global $xml;
if (!mysql_num_rows($result)) cpg_die(ERROR, $lang_errors['non_exist_ap']);
$p_aid = -1 ;
   while ($row = mysql_fetch_array($result))
        {
                if ($row[aid] != $p_aid){
                }
                if (max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']){

               $xml .= "<image><file><![CDATA[$CONFIG[fullpath]$row[filepath]$CONFIG[normal_pfx]$row[filename]]]></file><caption><![CDATA[$row[title]]]></caption></image>";
} else {
               $xml .= "<image><file><![CDATA[$CONFIG[fullpath]$row[filepath]$row[filename]]]></file><caption><![CDATA[$row[title]]]></caption></image>";
}
               $p_aid = $row[aid] ;
}
$xml .= '</images></slideshow>';
echo $xml;
?>


Until I receive a couple of thumbs up, I'll hold off on submit.  Thanks for all the help.



[attachment deleted by admin]

Casper

Please use '[code ]' and '[/code ]' not '[php ]'/[/php ]'
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

rphMedia

Quote from: Casper on November 22, 2004, 08:22:29 PM
Please use '[code ]' and '[/code ]' not '[php ]'/[/php ]'

Could you 'please' edit my post correctly?

Casper

Hmmmm, don't know what happened there, it was ok when I checked it.

Anyway, done now.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

rphMedia

Thanks Casper, I was just messin'with ya'. Didn't know you didn't like the php tag.  Most dev boards frown on not using them.

Do 'you' see any trouble with that script? Should I just go ahead and post the stuff and let the stones fly?  I mean, it's only that file and a small swf file.  I was just hopin' to get one of you [dev] guys to comment whether it will conflict with anything.  Ah, heck with it.  Maybe just delete this post alogether and I can post in the Mod/Hack section and see what happens?

Casper

Yep, the best way is to post it with a warning that it's not fully tested, and see what comes back at you.
I'm too busy on other things to have a go at this myself at the moment.
And besides, I'm not really a coder at all.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here