[英]Redirect image to post url
當您單擊“在新標簽頁中打開圖像”時,我已經在google圖片中看到了某些網站,它將重定向到原始帖子的網址。
我的網站上有很多用php gd創建的圖像,這些圖像從帖子中獲取數據並創建圖像,其url與此類似:
example.com/img/(number-post-id)-some-text.jpg
和其后
example.com/post/(number-post-id)
當有人在新標簽頁中打開圖像時,是否可以將圖像重定向到原始帖子?
謝謝
/* 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>
據我了解,這是一個應解決您的q的代碼段:
<a href="http://example.com/imagelink" target="_blank"> <!-- target _blank opens in new tab--> <img src="http://example.com/image.extension"> </a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.