Skip to content

Instantly share code, notes, and snippets.

@YuzuruSano
Created November 12, 2015 07:49
Show Gist options
  • Save YuzuruSano/beb414d99b993bfebf09 to your computer and use it in GitHub Desktop.
Save YuzuruSano/beb414d99b993bfebf09 to your computer and use it in GitHub Desktop.
【concrete5 5.7】任意のサムネイルが存在するかどうか判定して画像srcを出力
<?php
$file_obj = File::getByID($file);
if($file_obj) {
$handles = array();
foreach($file_obj->getThumbnails() as $ff){
$handles[] = $ff->getThumbnailTypeVersionObject()->getHandle();
}
if(in_array('thumb01', $handles)){
$file_src = $file_obj->getThumbnailURL('thumb01');
}else if(in_array('thumb02', $handles)){
$file_src = $file_obj->getThumbnailURL('thumb02');
}else{
$file_src = $file_obj->getThumbnailURL('full');
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment