Hey all,
I apologize if I should be able to figure this out on my own, but I've been working on it for a few days and I just don't know how to write this. A veteran SS'er should probably find this pretty trivial...
I have a page that has a different layout based on whether a photo on the page is landscape or portrait oriented. I want to write a boolean function isHorizontal so that I can have a template that looks something like this:
...
<% if isHorizontal %>
// Horizontal code here
<% else %>
// Vertical code here
<% end_if %>
Right now, I have created a function inside the Controller class for the page that goes like this:
function isHorizontal() {
$result = rand(1,2);
if($result==1) return true;
return false;
}
This works exactly like I want it to, except it obviously just returns a random result for the image orientation rather than checking the image's height against its width. I've looked at the datamodel stuff and it's just a little bit over my head as I'm not great with PHP. If anyone is able to answer this, I would also be incredible appreciative if you could explain your answer. Thanks!