I'm trying to get my head around something I know should be simple. I'm working on an a site for an artist who'd like to upload a custom thumbnail for each of his images. I've added a second field called 'artist_thumbnail'. In my template I want to test to see if there's a custom thumbnail and if not get processwire to generate one automatically.
PHP isn't my strong point. Am I even close with this code?
foreach($page->children("limit=32") as $folio_item) {
if($folio_item->artist_thumbnail) {
$img = "<li><a rel='lightbox' title='{$folio_item->title}' href='{$image->url}'><img title='{$folio_item->title}' src='{$thumb->url}' alt='{$folio_item->title}'></a></li>";
} else if($folio_item->artist_image) {
$thumb = $folio_item->artist_image->size(100, 100);
$image = $folio_item->artist_image;
$img = "<li><a rel='lightbox' title='{$folio_item->title}' href='{$image->url}'><img title='{$folio_item->title}' src='{$thumb->url}' alt='{$folio_item->title}'></a></li>";
}
// Output the image
echo "$img";
}













