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: How to sort images displayed by cpmFetch  (Read 3143 times)

0 Members and 1 Guest are viewing this topic.

Adariel

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
How to sort images displayed by cpmFetch
« on: May 15, 2010, 06:55:32 am »

CPG 1.4.26
cpmFetch 2.0.0
Bridged with Joomla 1.5.15 at http://www.regapgreyhounds.com/gallery
Intermediate skill - I can tweak just about any code but can't always write my own

What I'm trying to do is get all of the images in a particular album, and display them using the album's default sort order, which for this example is a custom order as opposed to alpha or date related.  Specifically, I want the About REGAP's Rescue Farm article to display in the same order as the album thumbnail order.

I have some pages where sorting is important, and others where a random order is fine.  I could force the order on the Rescue Farm page by pulling the images via their ID, but for pages that have multiple rows upon rows of pictures that would be problematic and not very upgradeable.  I am moving the site from another location, so I am batch adding most of my gallery after FTPing the images in and thus don't have quite the control over the upload order, so the Last Added function won't work in this case either.

I am using the actual data array as opposed to the preset output because I like being in control of how things display :).  The code I have so far is below.  Overall I have cpmFetch working as I want it to but I can't determine if there's an item in the cpmFetch array for the images that lists what the sort order is.  Looking over the print_r output, it just doesn't seem to have it, so I'm wondering if it's in another location or if there's something else that could be tweaked to add this functionality in?

Code: [Select]
<?php
include_once "./path/to/cpmfetch.php";
$objCpm = new cpm("./path/to/cpmfetch_config.php");

$objCpm->cpm_setReturnType("resultset");
$results $objCpm->cpm_viewRandomMediaFrom("album=6"15);

foreach (
$results as $image => $img) {
echo '
<table class="cpg_table_style1">
<tr class="cpg_row_style1">
<td class="cpg_cell_style1" valign="top">
<a href="http://www.regapgreyhounds.com/gallery/displayimage.php?pos=-'
.$img[pPid].'" class="cpg_link_style1" target="_parent">
<img src="http://www.regapgreyhounds.com/gallery/'
.$img[fullPathToThumb].'" class="cpg_img_style1" />
</a>
</td>
<td class="cpg_cell_style1" valign="top">
<b>'
.$img[pTitle].'</b><br />
     '
.$img[pCaption].'<br />
</td>
</tr>
</table>
'
;
}

$objCpm->cpm_close();
?>




Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 20 queries.