Skip to content

Instantly share code, notes, and snippets.

@javimata
Created April 8, 2016 16:57
Show Gist options
  • Save javimata/099785dad78336e1febbdef9fc15799c to your computer and use it in GitHub Desktop.
Save javimata/099785dad78336e1febbdef9fc15799c to your computer and use it in GitHub Desktop.
<?php
$array_images = array();
$imagen = $this->item->imagenes;
$array_images[0] = $imagen;
$imagenes = json_decode($this->item->images);
if (count($imagenes)):
foreach ($imagenes as $key => $value) {
if ( $value!="" && JFile::exists($value) ):
array_push($array_images, $value);
endif;
}
endif;
if (count($array_images)==1):
if ($array_images[0]<>"" && JFile::exists($array_images[0])):
?>
<div class="imagen">
<img src="<?php echo JURI::BASE(true) . "/" . $array_images[0]; ?>" class="img-responsive">
</div>
<?php endif;?>
<?php else: ?>
<div class="imagen imagen-slick">
<?php foreach($array_images as $imagen):
if (JFile::exists($array_images[0]) && $imagen!=""):
?>
<div><img src="<?php echo JURI::BASE(true) . "/" . $imagen; ?>" class="img-responsive"></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment