How to sort images displayed by cpmFetch How to sort images displayed by cpmFetch
 

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]

Main Menu

How to sort images displayed by cpmFetch

Started by Adariel, May 15, 2010, 06:55:32 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Adariel

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?


<?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();
?>