# Preview of images not working for png and jpg when using nginx

**URL:** <https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509>\
**Category:** Support\
**Created:** [June 11, 2020, 7:07pm UTC](https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509 "2020-06-11T19:07:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![terencejackson8000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/terencejackson8000/32/641_2.png) [@terencejackson8000](https://discourse.getcockpit.com/u/terencejackson8000)\
**Post date:** [June 11, 2020, 7:07pm UTC](https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509/1 "2020-06-11T19:07:53Z")

</div>

Dear all,

I moved my Cockpit installation from a apache to a nginx with PHP 7.3.  
After moving the data I can see all my collections, … and assets. The problem is, that I cannot see the preview for png and jpg in the asset section. I can only see the preview for svg.

 ![Image Preview Error](https://canada1.discourse-cdn.com/flex030/uploads/getcockpit/original/1X/38c6a408188eded81614627f57f5366fd265e2bf.png)

Once I click on the image, I can see it in the pop up. This indicates that the image is indeed there and the migration was succesfull.

Do you know why the preview is not working? Could this be a PHP GD issue? Or do I need a special PHP extension enabled for this?

TJ

---

<div class="post-metadata">

**Author:** ![terencejackson8000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/terencejackson8000/32/641_2.png) [@terencejackson8000](https://discourse.getcockpit.com/u/terencejackson8000)\
**Post date:** [June 12, 2020, 8:20pm UTC](https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509/2 "2020-06-12T20:20:26Z")

</div>

I have also tried this with a completely new installation with the same result ☹  
Does anyone know how to fix this?

---

<div class="post-metadata">

**Author:** ![joshinat0r](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/joshinat0r/32/664_2.png) [@joshinat0r](https://discourse.getcockpit.com/u/joshinat0r)\
**Post date:** [August 9, 2020, 11:36am UTC](https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509/3 "2020-08-09T11:36:28Z")

</div>

If anyone else is stumbling across this question, found a fix [here](https://github.com/agentejo/cockpit/issues/1031)

The `$is_args` in my nginx conf was missing, thats why the thumbnail options were the defaults (and throw errors about missing height/width and src)

```
    location / {
            try_files $uri $uri/ /index.php$is_args$args;
    }
```

---

<div class="post-metadata">

**Author:** ![terencejackson8000](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/terencejackson8000/32/641_2.png) [@terencejackson8000](https://discourse.getcockpit.com/u/terencejackson8000)\
**Post date:** [August 21, 2020, 5:54pm UTC](https://discourse.getcockpit.com/t/preview-of-images-not-working-for-png-and-jpg-when-using-nginx/1509/4 "2020-08-21T17:54:46Z")

</div>

Awesome. It worked! Thanks a lot @joshinat0r
