500 Internal Server Error with Page Attribute
Permalink
In one of my page types, I'm calling for a page attribute (Image/File) so I can size it and place it on the page.
Here is how I am calling the attribute:
Later in my template, I am placing the image on the page with this:
What I've discovered is that if a page doesn't have that attribute attached to it or if it is attached, but no image is define, that page returns a 500 Internal Server Error and the page stops rendering at the point where the image should be placed.
I'm not sure how to fix this.
Any help would be greatly appreciated.
Thanks!
Here is how I am calling the attribute:
<?php $ih = Loader::helper('image'); $p = $c->getCurrentPage(); $img = $p->getAttribute('news_image'); if(isset($img)) { $thumb = $ih->getThumbnail($img, 320, 9999); } ?>
Later in my template, I am placing the image on the page with this:
What I've discovered is that if a page doesn't have that attribute attached to it or if it is attached, but no image is define, that page returns a 500 Internal Server Error and the page stops rendering at the point where the image should be placed.
I'm not sure how to fix this.
Any help would be greatly appreciated.
Thanks!