forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: Adariel on May 15, 2010, 06:55:32 am

Title: How to sort images displayed by cpmFetch
Post by: Adariel 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 (http://www.regapgreyhounds.com/index.php?option=com_content&view=category&layout=blog&id=39&Itemid=61) article to display in the same order as the album thumbnail (http://www.regapgreyhounds.com/gallery/thumbnails.php?album=6) 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();
?>