Skip to content

Instantly share code, notes, and snippets.

@davidimoore
Created April 10, 2015 19:27
Show Gist options
  • Save davidimoore/7df63fc65589a83c9217 to your computer and use it in GitHub Desktop.
Save davidimoore/7df63fc65589a83c9217 to your computer and use it in GitHub Desktop.
function obj_present($resource, $value){
if(isset($resource[$value]) || $resource[$value] != '0'){
return $resource[$value];
}
}
function image_tag($image_data) {
echo "<img src='" . img::getImg($image_data, 1) . "'>";
}
static function getResourceImage($resource) {
if(obj_present($resource, 'image1')){
image_tag($resource['image1']);
}elseif(obj_present($resource, 'image2')){
image_tag($resource['image2']);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment