|
|
| |
Forums ⇒ DragonflyCMS ⇒ Coppermine ⇒ Block to take images from selected album
Block to take images from selected albumPlease post bugs in the Projects Module. Post anything and everything else about Coppermine in this forum.
Go to page 1, 2 Next
|
View previous topic :: View next topic |
| Author |
Message |
aussie Newbie


Offline Joined: Jan 20, 2006 Posts: 2 Location: Dallas
|
Posted: Fri Jan 20, 2006 5:09 am Post subject: Block to take images from selected album |
|
I have a scrolling block and would like to just select random pictures from one album. Can one of these blocks be changed and if so what would I need to change to select the album needed?
Thanks.
_________________ best regards
Aussie
aussie's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) php
|
|
| Back to top |
|
 |
Śyama_Dāsa Developer


Offline Joined: Apr 19, 2004 Posts: 2048 Location: Dragonfly CMS Tribe
|
Posted: Fri Jan 20, 2006 6:51 am Post subject: Re: Block to take images from selected album |
|
sure, just post your website and specs here, directions are in my signature.
Then open the scrolling random block and post the queries here we will help you modify them.
_________________ AKA Akamu / Read these and your life will be successful | Find a Repair
--
Mods and Professional Support via YIM
Śyama_Dāsa's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) win32 / Apache 1.3.33 / MySQL 4.1.16/PHP 4.4/CPG-CVS ( browsers: Mozilla 1.7.x / IE6 / Opera 8.0)
|
|
| Back to top |
|
 |
aussie Newbie


Offline Joined: Jan 20, 2006 Posts: 2 Location: Dallas
|
Posted: Fri Jan 20, 2006 7:13 am Post subject: Re: Block to take images from selected album |
|
| Code:: |
// modified by DJMaze
$result = $db->sql_query("SELECT COUNT(*) FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' GROUP BY pid");
$nbEnr = $db->sql_fetchrow($result);
$pic_count = $nbEnr[0];
// mysql_free_result($result);
// if we have more than 1000 pictures, we limit the number of picture returned
// by the SELECT statement as ORDER BY RAND() is time consuming
if ($pic_count > 1000) {
$result = $db->sql_query("SELECT COUNT(*) from " . $cpg_prefix . "pictures WHERE approved = 'YES'");
$nbEnr = mysql_fetch_row($result);
$total_count = $nbEnr[0];
// mysql_free_result($result);
$granularity = floor($total_count / 1000);
$cor_gran = ceil($total_count / $pic_count);
srand(time());
for ($i = 1; $i <= $cor_gran; $i++) $random_num_set = rand(0, $granularity) . ', ';
$random_num_set = substr($random_num_set, 0, -2);
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE randpos IN ($random_num_set) AND approved='YES' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} else {
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
}
$rowset = array();
while ($row = $db->sql_fetchrow($result)) {
if ($CONFIG['seo_alts'] == 0) {
$thumb_title = $row['filename'];
} else {
if ($row['title'] != '') {
$thumb_title = $row['title'];
} else {
$thumb_title = substr($row['filename'], 0, -4);
}
}
stripslashes($thumb_title);
$content .= '<a href="' . $CPG_M_URL . '&file=displayimage&album='.$row['aid'].'&pos=' . $row["pid"] . '"><img src="' . get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '"><br />' . truncate_string_randpic($thumb_title) . '</a><br />';
}
$content .= '<br /><a href="' . $CPG_M_URL . '">'.$lang_pagetitle_php["photogallery"].'</a></p>';
?> |
Need to pick pictures from the category Agents Pictures and album also Agents Pictures. I woiuld appreciate any help you can give me.
I am also a newbie at this kind of thing so please excuse any ignorance.
Thanks
_________________ best regards
Aussie
aussie's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) php
|
|
| Back to top |
|
 |
sarah Debugger


Offline Joined: Mar 25, 2005 Posts: 2130
|
Posted: Fri Jan 20, 2006 8:21 am Post subject: Re: Block to take images from selected album |
|
Photo Gallery is access denied, otherwise I would look to see what that album id is. You'll need the album id, which you can get from the url when viewing that album. Then, untested but this should work,
Change this part:
| Code:: |
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE randpos IN ($random_num_set) AND approved='YES' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} else {
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} |
To:
| Code:: |
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE randpos IN ($random_num_set) AND approved='YES' AND p.aid='xxx' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} else {
// modified by DJMaze
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' AND p.aid='xxx' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} |
But where you see those xxx, replace them with your real album id.
sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
|
|
| Back to top |
|
 |
Śyama_Dāsa Developer


Offline Joined: Apr 19, 2004 Posts: 2048 Location: Dragonfly CMS Tribe
|
Posted: Fri Jan 20, 2006 9:11 pm Post subject: Re: Block to take images from selected album |
|
| http://www.ictravelhost.com/portal wrote: |
| PHP-Nuke Copyright 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. |
I hope you are doing this for your new install of Dragonfly.....
_________________ AKA Akamu / Read these and your life will be successful | Find a Repair
--
Mods and Professional Support via YIM
Śyama_Dāsa's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) win32 / Apache 1.3.33 / MySQL 4.1.16/PHP 4.4/CPG-CVS ( browsers: Mozilla 1.7.x / IE6 / Opera 8.0)
|
|
| Back to top |
|
 |
sarah Debugger


Offline Joined: Mar 25, 2005 Posts: 2130
|
Posted: Fri Jan 20, 2006 11:33 pm Post subject: Re: Block to take images from selected album |
|
I need to start checking those better first.
sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
|
|
| Back to top |
|
 |
venumsgurl Silver Supporter


Offline Joined: Feb 21, 2005 Posts: 59 Location: Virginia, United States
|
Posted: Sun Jan 22, 2006 1:03 am Post subject: Re: Block to take images from selected album |
|
Thanks for this, it worked for me!
_________________ Once an evil deed is done then it cannot be undone... it goes on and it will go on forever.
venumsgurl's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Operating system Linux, Architecture i686, Apache version 2.2.9 (Unix),PHP version 5.2.6,MySQL version 5.0.67-community, Dragonfly ver 9.2.1
|
|
| Back to top |
|
 |
Dizfunkshunal Platinum Supporter


Offline Joined: Mar 23, 2006 Posts: 2064
|
Posted: Wed Apr 25, 2007 4:55 am Post subject: Re: Block to take images from selected album |
|
well i guess i am missing something but what is it? I put in the album=24
link to the album
| PHP: |
<?php /********************************************* CPG Dragonfly™ CMS ******************************************** Copyright © 2004 - 2005 by CPG-Nuke Dev Team www.dragonflycms.com
Dragonfly is released under the terms and conditions of the GNU GPL version 2 or any later version
$Source: /cvs/html/blocks/block-CPG-scroll-Random_pictures.php,v $ $Revision: 9.7 $ $Author: djmaze $ $Date: 2006/01/16 12:19:33 $ Encoding test: n-array summation ∑ latin ae w/ acute ǽ ********************************************************/ if (!defined('CPG_NUKE')) { exit; } global $prefix, $db, $CONFIG, $cpg_dir,$cpg_prefix; $cpg_dir = 'coppermine';
if (!is_active($cpg_dir)) { $content = 'ERROR'; return trigger_error($cpg_dir.' module is inactive', E_USER_WARNING); }
$cpg_block = true; require("modules/".$cpg_dir."/include/load.inc"); $cpg_block = false; $numberpic = $CONFIG['thumbcols']; //number of thumbs // $numberpic=4; //number of thumbs $limit = $numberpic; $maxlength = 20; // maximum length of name in block
// marquee info at www.faqs.org/docs/html...RQUEE.html $content = '<p align="center"><a name="scroller"></a><marquee loop="0" behavior="scroll" direction="up" height="150" scrollamount="1" scrolldelay="1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><center>'; // END USER DEFINABLES $result = $db->sql_query("SELECT COUNT(*) FROM ".$cpg_prefix."pictures as p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved=1 GROUP BY pid"); $pic_count = $db->sql_numrows($result); //$pic_count = $nbEnr[0]; $total_count = $granularity = $cor_gran = $random_num_set = $thumb_title = ''; $db->sql_freeresult($result); // if we have more than 1000 pictures, we limit the number of picture returned // by the SELECT statement as ORDER BY RAND() is time consuming if ($pic_count > 1000) { $result = $db->sql_query("SELECT COUNT(*) from " . $cpg_prefix . "pictures WHERE approved = 1"); $nbEnr = $db->sql_fetchrow($result); $total_count = $nbEnr[0]; $db->sql_freeresult($result); $granularity = floor($total_count / 1000); $cor_gran = ceil($total_count / $pic_count); srand(time()); for ($i = 1; $i <= $cor_gran; $i++) $random_num_set = rand(0, $granularity) . ', '; $random_num_set = substr($random_num_set, 0, -2); $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE randpos IN ($random_num_set) AND approved='YES' AND p.aid='album=24' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit"); } else { $result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved='YES' AND p.aid='album=24' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit"); } $rowset = array(); while ($row = $db->sql_fetchrow($result)) { if ($CONFIG['seo_alts'] == 0) { $thumb_title = $row['filename']; } else { if ($row['title'] != '') { $thumb_title = $row['title']; } else { $thumb_title = substr($row['filename'], 0, -4); } } $content .= '<a href="' .getlink("$cpg_dir&file=displayimage&album=".$row['aid']."&pid=" . $row['pid']). '"><img src="' .get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($thumb_title,$maxlength) . '</a><br />'; } $content .= '</center></marquee><center><a href="' . getlink("$cpg_dir") . '">'._coppermineLANG.'</a></center>';
|
_________________ Diz Web Design Status: Open (Use of resources requires registration.)
Dizfunkshunal's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Multiple Setups
|
|
| Back to top |
|
 |
sarah Debugger


Offline Joined: Mar 25, 2005 Posts: 2130
|
Posted: Wed Apr 25, 2007 5:02 am Post subject: Re: Block to take images from selected album |
|
p.aid='24'
Also, I don't see any pictures in that album, but maybe you meant it to be that way.
_________________ Diagon Alley - Top Design
sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
|
|
| Back to top |
|
 |
Dizfunkshunal Platinum Supporter


Offline Joined: Mar 23, 2006 Posts: 2064
|
Posted: Wed Apr 25, 2007 4:34 pm Post subject: Re: Block to take images from selected album |
|
I tried that its not working also had to change the id from 24 to 25 same code as above any other ideas? thanks
_________________ Diz Web Design Status: Open (Use of resources requires registration.)
Dizfunkshunal's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Multiple Setups
|
|
| Back to top |
|
 |
sarah Debugger


Offline Joined: Mar 25, 2005 Posts: 2130
|
Posted: Wed Apr 25, 2007 5:54 pm Post subject: Re: Block to take images from selected album |
|
Oh dude, this is an old thread.
| Code:: |
<?php
/*********************************************
CPG Dragonfly™ CMS
********************************************
Copyright © 2004 - 2005 by CPG-Nuke Dev Team
http://www.dragonflycms.com
Dragonfly is released under the terms and conditions
of the GNU GPL version 2 or any later version
$Source: /cvs/html/blocks/block-CPG-scroll-Random_pictures.php,v $
$Revision: 9.7 $
$Author: djmaze $
$Date: 2006/01/16 12:19:33 $
Encoding test: n-array summation ∑ latin ae w/ acute ǽ
********************************************************/
if (!defined('CPG_NUKE')) { exit; }
global $prefix, $db, $CONFIG, $cpg_dir,$cpg_prefix;
$cpg_dir = 'coppermine';
if (!is_active($cpg_dir)) {
$content = 'ERROR';
return trigger_error($cpg_dir.' module is inactive', E_USER_WARNING);
}
$cpg_block = true;
require("modules/".$cpg_dir."/include/load.inc");
$cpg_block = false;
$numberpic = $CONFIG['thumbcols']; //number of thumbs
// $numberpic=4; //number of thumbs
$limit = $numberpic;
$maxlength = 20; // maximum length of name in block
// marquee info at http://www.faqs.org/docs/htmltut/_MARQUEE.html
$content = '<p align="center"><a name="scroller"></a><marquee loop="0" behavior="scroll" direction="up" height="150" scrollamount="1" scrolldelay="1" onmouseover=\'this.stop()\' onmouseout=\'this.start()\'><center>';
// END USER DEFINABLES
$result = $db->sql_query("SELECT COUNT(*) FROM ".$cpg_prefix."pictures as p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved=1 GROUP BY pid");
$pic_count = $db->sql_numrows($result);
//$pic_count = $nbEnr[0];
$total_count = $granularity = $cor_gran = $random_num_set = $thumb_title = '';
$db->sql_freeresult($result);
// if we have more than 1000 pictures, we limit the number of picture returned
// by the SELECT statement as ORDER BY RAND() is time consuming
if ($pic_count > 1000) {
$result = $db->sql_query("SELECT COUNT(*) from " . $cpg_prefix . "pictures WHERE approved = 1");
$nbEnr = $db->sql_fetchrow($result);
$total_count = $nbEnr[0];
$db->sql_freeresult($result);
$granularity = floor($total_count / 1000);
$cor_gran = ceil($total_count / $pic_count);
srand(time());
for ($i = 1; $i <= $cor_gran; $i++) $random_num_set = rand(0, $granularity) . ', ';
$random_num_set = substr($random_num_set, 0, -2);
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE randpos IN ($random_num_set) AND approved=1 AND p.aid='25' GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
} else {
$result = $db->sql_query("SELECT pid, filepath, filename, p.aid, p.title FROM ".$cpg_prefix."pictures AS p INNER JOIN ".$cpg_prefix."albums AS a ON (p.aid = a.aid AND ".VIS_GROUPS.") WHERE approved=1 AND p.aid='25'GROUP BY pid ORDER BY RAND() DESC LIMIT $limit");
}
$rowset = array();
while ($row = $db->sql_fetchrow($result)) {
if ($CONFIG['seo_alts'] == 0) {
$thumb_title = $row['filename'];
} else {
if ($row['title'] != '') {
$thumb_title = $row['title'];
} else {
$thumb_title = substr($row['filename'], 0, -4);
}
}
$content .= '<a href="' .getlink("$cpg_dir&file=displayimage&album=".$row['aid']."&pid=" . $row['pid']). '"><img src="' .get_pic_url($row, 'thumb') . '" border="0" alt="' . $thumb_title . '" title="' . $thumb_title . '" /><br />' . truncate_stringblocks($thumb_title,$maxlength) . '</a><br />';
}
$content .= '</center></marquee><center><a href="' . getlink("$cpg_dir") . '">'._coppermineLANG.'</a></center>';
|
_________________ Diagon Alley - Top Design
sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
|
|
| Back to top |
|
 |
Dizfunkshunal Platinum Supporter


Offline Joined: Mar 23, 2006 Posts: 2064
|
Posted: Wed Apr 25, 2007 9:44 pm Post subject: Re: Block to take images from selected album |
|
an oldie but a goodie
_________________ Diz Web Design Status: Open (Use of resources requires registration.)
Dizfunkshunal's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Multiple Setups
|
|
| Back to top |
|
 |
Dizfunkshunal Platinum Supporter


Offline Joined: Mar 23, 2006 Posts: 2064
|
Posted: Wed Apr 25, 2007 9:47 pm Post subject: Re: Block to take images from selected album |
|
thanks that worked great
_________________ Diz Web Design Status: Open (Use of resources requires registration.)
Dizfunkshunal's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Multiple Setups
|
|
| Back to top |
|
 |
sarah Debugger


Offline Joined: Mar 25, 2005 Posts: 2130
|
Posted: Wed Apr 25, 2007 9:52 pm Post subject: Re: Block to take images from selected album |
|
NP. Database changes in coppermine since I posted the first one.
_________________ Diagon Alley - Top Design
sarah's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Linux/1.3.37/4.1.21-standard/4.4.4/9.1.1
|
|
| Back to top |
|
 |
Dizfunkshunal Platinum Supporter


Offline Joined: Mar 23, 2006 Posts: 2064
|
Posted: Wed Apr 25, 2007 10:03 pm Post subject: Re: Block to take images from selected album |
|
thanks just so anyone else reads this that last code posted will work with 9.1.1
_________________ Diz Web Design Status: Open (Use of resources requires registration.)
Dizfunkshunal's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS) Multiple Setups
|
|
| Back to top |
|
 |
|
|
All times are GMTGo to page 1, 2 Next
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
| |
 |
 Welcome Anonymous
|
|
|
|