Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pmfx
Created October 1, 2016 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmfx/6f08c5e2c7c18a9b1bff7300f3c04a3d to your computer and use it in GitHub Desktop.
Save pmfx/6f08c5e2c7c18a9b1bff7300f3c04a3d to your computer and use it in GitHub Desktop.
Get first picture thumb path from EvoGallery MODX snippet.
<?php
$output='';
if($id){
$table = $modx->getFullTableName( 'portfolio_galleries' );
$query = $modx->db->query('SELECT content_id,filename,sortorder FROM '.$table.' WHERE content_id='.$id.' ORDER BY sortorder ASC LIMIT 0,1');
$row = $modx->db->getRow($query);
$gal_id = $row['content_id'];
$gal_filename = $row['filename'];
if ($row){
$output = 'assets/galleries/'.$gal_id.'/thumbs/'.$gal_filename;
}
}
return $output;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment