# How to make a thumbnail image a link?

**URL:** <https://www.phphelp.com/t/how-to-make-a-thumbnail-image-a-link/34025>\
**Category:** Uncategorized\
**Created:** [October 1, 2021, 7:32am UTC](https://www.phphelp.com/t/how-to-make-a-thumbnail-image-a-link/34025 "2021-10-01T07:32:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fa2020](https://www.phphelp.com/letter_avatar_proxy/v4/letter/f/5daacb/32.png) [@fa2020](https://www.phphelp.com/u/fa2020)\
**Post date:** [October 1, 2021, 7:32am UTC](https://www.phphelp.com/t/how-to-make-a-thumbnail-image-a-link/34025/1 "2021-10-01T07:32:20Z")

</div>

Hi,  
I’m using this code in my image gallery project:

```
<div class="grid-portfolio" id="portfolio">

    <div class="container">

      <div class="row">

        <?php while ($row = $result->fetch_assoc()) { ?>

          <div class="col-md-4 col-sm-6">

            <div class="portfolio-item">

              <div class="thumb">

                <a href="<?php echo $root ?>/public/assets/img/<?php echo $row['image'] ?>" data-lightbox="image-1">

                  <div class="hover-effect">

                    <div class="hover-content">

                      <h1><?php echo $row['title_1'] ?> <em><?php echo $row['title_2'] ?></em></h1>

                      <p><?php echo $row['subtitle'] ?></p>

                    </div>

                  </div>

                </a>

                <div class="image">

                  <img src="<?php echo $root ?>/public/assets/uploadThumb/<?php echo $row['thumb'] ?>">

                </div>

              </div>

            </div>

          </div>

        <?php } ?>

      </div>

      <div class="row">

        <div class="col-md-12">

          <div class="load-more-button">

            <a href="#">Load More</a>

          </div>

        </div>

      </div>

    </div>

  </div>

```

The problem is that the text area in the image is clickable, while I want the whole thumbnail to be clickable. How can I fix it?

---

<div class="post-metadata">

**Author:** ![whispers](https://www.phphelp.com/letter_avatar_proxy/v4/letter/w/858c86/32.png) [@whispers](https://www.phphelp.com/u/whispers)\
**Post date:** [October 1, 2021, 1:18pm UTC](https://www.phphelp.com/t/how-to-make-a-thumbnail-image-a-link/34025/2 "2021-10-01T13:18:34Z")

</div>

Please rephrase what it is you want done… “images” -do not- have textareas. Images are images.

Perhaps you are looking for something like this:

```auto
<a href="<?php echo $root ?>/public/assets/img/<?php echo $row['image'] ?>" data-lightbox="image-1">

                  <div class="hover-effect">

                    <div class="hover-content">

                      <h1><?php echo $row['title_1'] ?> <em><?php echo $row['title_2'] ?></em></h1>

                      <p><?php echo $row['subtitle'] ?></p>

                    </div>

                  </div>

               

                <div class="image">

                  <img src="<?php echo $root ?>/public/assets/uploadThumb/<?php echo $row['thumb'] ?>">

                </div>
 </a>

```

---

<div class="post-metadata">

**Author:** ![ErnieAlex](https://www.phphelp.com/letter_avatar_proxy/v4/letter/e/bc8723/32.png) [@ErnieAlex](https://www.phphelp.com/u/ErnieAlex)\
**Post date:** [October 1, 2021, 1:21pm UTC](https://www.phphelp.com/t/how-to-make-a-thumbnail-image-a-link/34025/3 "2021-10-01T13:21:44Z")

</div>

> [@fa2020](#):
>
> `<a href="<?php echo $root ?>` … \< /a\>

Just place your anchor tags around everything that you want to become the link. You can place the tags around DIV’s as needed. You could place them around the portfolio-item or the col-md-4 div’s to make them entirely clickable. I would guess you just want to put them around the entire “thumb” DIV which would make it all clickable.  
\*\*\*Sorry, Whispers answered it while I was typing…
