Skip to content

Instantly share code, notes, and snippets.

@pmfx
Created October 1, 2016 17:36
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/5613455a9d0c110e4c0dc18c057cf8b4 to your computer and use it in GitHub Desktop.
Save pmfx/5613455a9d0c110e4c0dc18c057cf8b4 to your computer and use it in GitHub Desktop.
Get first picture 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.'/'.$gal_filename;
}
}
return $output;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment