Getting the image on state

Permalink
Hi all,

Im currently looking for a way to pull the image on state into a custom image block, here is the code i have so far:

<?php    defined('C5_EXECUTE') or die(_("Access Denied."));
$ih = Loader::helper('image'); // load the c5 image helper
$img = File::getByID($fID); // get the image
$imagePath = $img->getURL(); // get the image path
$imageTitle = $img->getTitle(); // get the image title
$imgHover = File::getByID($fID=2); // get the image
$imgHoverPath = $imgHover->getURL();
 ?>  
<?php if($width == 0):?>
<a class="fancybox" data-fancybox-group="gallery" title="<?php echo $imageTitle;?>" href="<?php echo $imagePath;?>">
   <img src="<?php echo $imagePath;?>" title="<?php echo $imageTitle;?>"/>
   <?php print_r( $imgHoverPath); ?>
</a>
<?php endif; ?>




As you can see i thought that the image on state is '=2' however this doesn't seem to pull anything, any help would be awesome. Thanks.

 
andyjoneski replied on at Permalink Reply
Never mind i found it :)

<?php    defined('C5_EXECUTE') or die(_("Access Denied."));
$ih = Loader::helper('image'); // load the c5 image helper
$img = File::getByID($fID); // get the image
$imagePath = $img->getURL(); // get the image path
$imageTitle = $img->getTitle(); // get the image title
$imgHover = File::getByID($fOnstateID); // get the image
$imgHoverPath = $imgHover->getURL();
 ?>  
<?php if($width == 0):?>
<a class="fancybox" data-fancybox-group="gallery" title="<?php echo $imageTitle;?>" href="<?php echo $imagePath;?>">
   <img src="<?php echo $imagePath;?>" title="<?php echo $imageTitle;?>"/>
</a>
<img src="<?php  echo $imgHoverPath; ?>" >
<?php endif; ?>