To create image link PHP?

Hello! Help to form a link to the image. There is a preliminary helper.php!
<?php

 class modFliperImgsMegaHelper
{
 // check if directory exists
 if (is_dir(JPATH_BASE.DS.$folder))
{
 $files = modFliperImgsMegaHelper::getFiles($folder,$substoo,$random);
 $i = 0;
 $repeated = 0;
 foreach ($files as $file)
{
 if (modFliperImgsMegaHelper::isImage($file)) {
 $file = str_replace( '\\', '/', $file );
 $images[$i] = JHTML::_('image', $file, ", $attribs);
$repeated++;
++$i;
}
}
}
 return $images;
}
 ?>

I have a template that displays images, 1-e, if the list is, 2-e, if indicated folder.
<?php if ($source==1) { ?>

 <div id="myflipper">
<?php
 $image1 = explode("\n",$image);
 for ($i=0;$i<count($image1);$i++) {
?>
 <div class="flipper-page no-padding">
 <a href="<?php echo $image1[$i]; ?>"><img src="<?php echo $image1[$i];?>" class="fullsize"></a>
</div>
 <?php } ?>
</div>


<?php } else { ?>
 <div id="myflipper">
 <?php foreach ( $images as $image ) { ?>
 <div class="flipper-page no-padding">
 <?php echo $image;?>
</div>
 <?php } ?>
</div>

 <?php } ?>

In the second embodiment, pictures are displayed $image, how do I make a link url on the photo if
to register so:
<a href="<?php echo $image; ?>"><?php echo $image;?></a>
photo displays but the url writes the html tag for images
I would be grateful for help.
June 27th 19 at 15:03

Find more questions by tags HTMLPHP