I've seen some websites in google images when you click "open image in new tab" it redirects to the url of the original post.
I have my website that has a lot of images created with php gd which take the data from the post and create the image, the url it's similar to this:
example.com/img/(number-post-id)-some-text.jpg
and the post its
example.com/post/(number-post-id)
It's there a way to redirect the images to the original post when somebody open the image in a new tab?
thanks
/* add a little bottom space under the images */
.thumbnail {
margin-bottom:7px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"/>
<div class="container">
<h1>Image Grid</h1>
<b> NOTE: </b> Try To Open With <kbd>`Right Click`</kbd> <b> > </b> <kbd> `Open Link In New Tab`</kbd> Or .. With
<kbd>Ctrl<kbd> + <kbd> Click<kbd>
<hr>
<div class="row">
<div class="col-xs-3">
<a href="https://www.google.com" class="thumbnail"> Google
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="https://www.facebook.com" class="thumbnail"> facebook
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="https://www.stackoverflow.com" class="thumbnail"> stackoverflow
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="www.yahoo.in" class="thumbnail"> yahoo.in
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
<div class="col-xs-3">
<a href="#" class="thumbnail">
<img src="http://placehold.it/350x150" class="img-responsive">
</a>
</div>
</div>
<hr>
</div>
From what I understood, this is a snippet that should solve your q:
<a href="http://example.com/imagelink" target="_blank"> <!-- target _blank opens in new tab-->
<img src="http://example.com/image.extension">
</a>
Related
It might be a little difficult to explain.
I want it to display the data in html format below from same category
The display will be like the preview. 1 category will display 3 items, amount 3
database
<div class="gallery lapps-main">
<div class="gallery_scroller no-scrollbar">
<div class="item">
<a class="lapp" href="" title="">
<figure><img src="" width="56" height="56" data-src="" class="lzl" alt="icon"></figure>
<p class="info">
<span class="name">1</span>
<span class="author">1</span>
</p>
</a>
<div class="item">
<a class="lapp" href="" title="">
<figure><img src="" width="56" height="56" data-src="" class="lzl" alt="icon"></figure>
<p class="info">
<span class="name">1</span>
<span class="author">1</span>
</p>
</a>
</div>
<div class="item">
<a class="lapp" href="" title="">
<figure><img src="" width="56" height="56" data-src="" class="lzl" alt="icon"></figure>
<p class="info">
<span class="name">1</span>
<span class="author">1</span>
</p>
</a>
</div>
<span class="gallery_btn prev"></span>
<span class="gallery_btn next"></span>
</div>
Hi i have used bootstrap carousel in my website.I have used data animation effects for moving texts from right to left from up and down and for image animation effects.But the data animation effects is not working in codeigniter php.
<div id="carousel-example-generic" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<!-- First slide -->
<div class="item active ">
<h3 class="heading82">OPEN SOURCE <span class="heading81">C</span>ONTENT <span class="heading81">M</span>ANAGEMENT <span class="heading81">S</span>YSTEMS</h3>
<img src="<?php echo base_url();?>theme/slider/3_1 (4).png" class="heading84"><h3 class="heading83">complete control over the content of the website from personalized admin panel</h3><img src="<?php echo base_url();?>theme/slider/4_2 (4).png" class="heading85">
<div class="captions">
<img src="<?php echo base_url();?>theme/slider/z2.png" class="heading94" data-animation="animated bounceInRight">
<img src="<?php echo base_url();?>theme/slider/z1.png" class="heading95" data-animation="animated bounceInRight">
<img src="<?php echo base_url();?>theme/slider/z.png" class="heading95" data-animation="animated bounceInRight">
<img src="<?php echo base_url();?>theme/slider/z3 (3).png" class="heading96" data-animation="animated bounceInRight">
</div>
<div class="carousel-caption" >
<h3 data-animation="animated bounceInDown" class="heading86">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading87"> Easy edit, delete and create new content
</h3>
<h3 data-animation="animated bounceInDown" class="heading88">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading89"> Manage your own online store with little or zero technical expertise
</h3>
<h3 data-animation="animated bounceInDown" class="heading90">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading91"> Convert your traffic into customers
</h3>
<h3 data-animation="animated bounceInDown" class="heading92">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading93"> Custom Design templates to manage your blogs
</h3>
</div>
</div> <!-- /.item -->
<!-- Second slide -->
<div class="item ">
<h3 class="heading43">FULLY <span class="heading41">R</span>ESPONSIVE & <span class="heading41">SEO</span> OPTIMIZED <span class="heading41">W</span>EBSITE <span class="heading41">D</span>ESIGN</h3>
<img src="<?php echo base_url();?>theme/slider/1 (2).png" class="heading45"><h3 class="heading44">Optimal viewing experience with easy reading and navigation on different mobiles & tablets</h3><img src="<?php echo base_url();?>theme/slider/2 (2).png" class="heading42">
<div class="carousel-caption">
<h3 data-animation="animated bounceInLeft" class="heading46">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading47"> We design custom build high impact site that attracts your target audience
</h3>
<h3 data-animation="animated bounceInLeft" class="heading48">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading49"> Ultra Responsive Design using HTML & CSS3
</h3>
<h3 data-animation="animated bounceInLeft" class="heading50">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading51"> 100% compatibility in all mobile devices and browsers
</h3>
<h3 data-animation="animated bounceInLeft" class="heading52">
<img src="<?php echo base_url();?>theme/slider/5.png" class="heading53"> We build scalable and smarter business solutions
</h3>
</div>
</div><!-- /.item -->
</div><!-- /.carousel-inner -->
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div><!-- /.carousel -->
i want solution for my problem.
in this image was a front end i need function behind on this
you can use bootstrap to develop gallery and php to get images dynamicalyy.
Instead of putting static image use php to load images from the database or url.
SEE OUR WORK
<span class="col-lg-4 col-md-5 col-sm-6 col-xs-12 col-lg-offset-4 col-md-offset-4 col-sm-offset-3 title-service-inner">
Vestibulum elementum ex ullamcorper ligula vulputate
</span>
</div>
<div class="row">
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/slider1.jpg"
alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/slider2.jpg"
alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/slider3.jpg"
alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/bg_image1.jpg" alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/bg_image2.jpg" alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/bg_image3.jpg" alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/bg_image.jpg" alt="Generic placeholder thumbnail"/>
</a>
</div>
<div class="col-sm-6 col-md-3">
<a href="#" class="thumbnail">
<img src="/theme_mytheme/static/src/img/bg_image5.jpg" alt="Generic placeholder thumbnail"/>
</a>
</div>
</div>
</div>
I'm trying to display odd and even posts, with different classes and sub-classes in a foreach loop in Laravel. I can't find anything in the documentation that suggests how to pull odd data differently from even data in a foreach loop.
#foreach ($posts as $post)
<li class="timeline-inverted">
<div class="timeline-badge primary" ><a title="{{ $post->created_at }}"><i class="glyphicon glyphicon-time invert" id=""></i></a></div>
<div class="timeline-panel">
<div class="timeline-header">
<div class="row">
<div class="col-xs-2">
<img class="img-responsive img-rounded" src="https://s.gravatar.com/avatar/2efde286ce7b0171a0dfedd1f3cff984?s=80&d=&r=G"">
</div>
<div class="col-xs-8">
<a> {{ $post->title }} </a> shared 6 hours ago
</div>
</div>
</div>
<div class="timeline-heading">
<div class="videowrapper">
<iframe height="300" src="https://www.youtube.com/embed/4PXXQzME5no" frameborder="0" allowfullscreen=""></iframe>
</div>
</div>
<div class="timeline-body">
<p>{{ $post->body }}</p>
</div>
<div class="timeline-footer">
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" src="" />
</a>
<div class="media-body">
<p>Comment</p>
November at 8:15am
</div>
</div>
<hr>
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" src="" />
</a>
<div class="media-body">Comment </div>
</div>
<hr>
<div class="media">
<a class="pull-left" href="#">
<img class="media-object" src="" />
</a>
<div class="media-body">Comment </div>
</div>
</div>
</div>
</li>
<li>
<div class="timeline-badge primary" ><a title="11 hours ago via Twitter"><i class="glyphicon glyphicon-time invert" id=""></i></a></div>
<div class="timeline-panel">
<div class="timeline-header">
<div class="row">
<div class="col-xs-2">
<img class="img-responsive img-rounded" src="https://s.gravatar.com/avatar/2efde286ce7b0171a0dfedd1f3cff984?s=80&d=&r=G"">
</div>
<div class="col-xs-8">
<a> {{ $post->title }} </a> shared 6 hours ago
</div>
</div>
</div>
<div class="timeline-heading">
<img class="img-responsive" src="img/img.png" />
<div class="timeline-images">
<div class="row">
<div class="col-xs-4">
<img src="img/img1.png" class="img-thumbnail img-responsive" />
</div>
<div class="col-xs-4">
<img src="img/img2.png" class="img-thumbnail img-responsive" />
</div>
<div class="col-xs-4">
<img src="img/img3.png" class="img-thumbnail img-responsive" />
</div>
</div>
</div>
</div>
<div class="timeline-body">
<p>{{ $post->body }}</p>
</div>
</div>
</li>
#endforeach
Please help. when i use the default carousel,
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
slide does work, but when i while looped the
<div class="item active">...</div> so the images will be dynamic, it doesnt slide anymore. instead, the images just stacked each other as seen here:
image here
Here is my code:
<!-- carousel -->
<div id="myCarousel" class="carousel slide " data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php
$x = new DB();
$y= $x->selectWithCount(0,'tblimagecarousel',null,null);
// var_dump($y);
$numofimages = $y->fetchColumn();
// echo $numofimages;
for($x=0;$x<$numofimages;$x++)
{
echo "<li data-target='#myCarousel' data-slide-to='{$x}'></li>";
}
?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<?php
$x = new DB();
$y= $x->select(0,'*','tblimagecarousel',null,null);
while($row = $y->fetchObject()){
echo"
<div class='item active'>
<img src='../assets/images/".$row->img."' alt='".$row->title."' width='100%' height='345'>
<div class='carousel-caption'>
<h3>".$row->title."</h3>
<p>".$row->description."</p>
</div>
</div>";
}
?>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev" >
<span><img src="../assets/images/ico_prev.png" height="50px" style="margin-top:500%"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span><img src="../assets/images/ico_next.png" height="50px" style="margin-top:500%"></span>
<span class="sr-only">Next</span>
</a>
</div>
I looked at your code your issue is in your loop
the carousel can only have ONE item with the active class at a time (if you only want one to show)
this does not contain the php portion you will have to construct your loop to NOT add the active class (possibly add the active class to the 1st item after)
HTML
<div class="item">
<img src="../assets/images/image1.png" alt="Image one" width="100%" height="345">
<div class="carousel-caption">
<h3>Image one</h3>
<p>Image Description 1</p>
</div>
</div>
<div class="item">
<img src="../assets/images/image2.png" alt="Image two" width="100%" height="345">
<div class="carousel-caption">
<h3>Image two</h3>
<p>Image Description 2</p>
</div>
</div>
<div class="item">
<img src="../assets/images/image3.png" alt="Image three" width="100%" height="345">
<div class="carousel-caption">
<h3>Image three</h3>
<p>Image Description 3</p>
</div>
</div>
<div class="item">
<img src="../assets/images/image4.png" alt="Image four" width="100%" height="345">
<div class="carousel-caption">
<h3>Image four</h3>
<p>Image Description 4</p>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span><img src="../assets/images/ico_prev.png" height="50px" ></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span><img src="../assets/images/ico_next.png" height="50px" ></span>
<span class="sr-only">Next</span>
</a>
</div>
CSS
body{background-color:#ccc;}
.item{height:400px;}
js
$(document).ready(function(){
$('#myCarousel').carousel();
//this will add the active class to the first item
$('.carousel-inner div.item:first-of-type' ).addClass( "active" );
})
You can view a fiddle HERE