Post images in blog posts are not displayed (wrong path)

Posted In General
  • stantyan 2 years ago
    Hi,
    
    I'm on a fresh install of GeekShop and noticed the following problem:
    
    Post images are uploaded to www.website.com/**storage**/posts/February2017/imagefilename.jpg
    
    but on the front-end they are tried to be served from
    www.website.com/**img**/posts/February2017/image.jpg
    
    Therefore (or maybe for some other reason) post images are not displayed and images are not found:
    
    [https://app.box.com/s/yasuqb6vsgbdn5idm3c6i7fyfoub7a7b](https://app.box.com/s/yasuqb6vsgbdn5idm3c6i7fyfoub7a7b)
    
    [https://app.box.com/s/aysm162iipbgrguk4jfx8xhxiqbzalsn](https://app.box.com/s/aysm162iipbgrguk4jfx8xhxiqbzalsn)
    
    Interesting is that on your demo post images are served from that /**img**/ folder and displayed well.
    
    How should I solve this?
    
    ![](https://app.box.com/representation/file_version_160061261620/image_2048/1.png?shared_name=lku5fhj4e1mvryf3pdi139ubdt08aa5g)

    Hi,

    I'm on a fresh install of GeekShop and noticed the following problem:

    Post images are uploaded to www.website.com/storage/posts/February2017/imagefilename.jpg

    but on the front-end they are tried to be served from www.website.com/img/posts/February2017/image.jpg

    Therefore (or maybe for some other reason) post images are not displayed and images are not found:

    https://app.box.com/s/yasuqb6vsgbdn5idm3c6i7fyfoub7a7b

    https://app.box.com/s/aysm162iipbgrguk4jfx8xhxiqbzalsn

    Interesting is that on your demo post images are served from that /img/ folder and displayed well.

    How should I solve this?

  • devdojo 2 years ago
    So, those routes are the correct routes for the images; however, you may not have a library installed that is needed to show those images.
    
    The images on the blog layout are using the [Glide Library](http://glide.thephpleague.com/) to do on-demand image manipulation. This way you could easily create an image of 100x100px and cache that image.
    
    Can you enable debug mode and open that image in a new tab and see what error message you receive and I can help you troubleshoot it further from there :)
    
    Thanks.

    So, those routes are the correct routes for the images; however, you may not have a library installed that is needed to show those images.

    The images on the blog layout are using the Glide Library to do on-demand image manipulation. This way you could easily create an image of 100x100px and cache that image.

    Can you enable debug mode and open that image in a new tab and see what error message you receive and I can help you troubleshoot it further from there :)

    Thanks.

  • stantyan 2 years ago
    How do I enable debug mode? I have this in my .env file:
    
    **APP_DEBUG=true
    APP_LOG_LEVEL=debug**
    
    is my debug mode enabled and where do I check the debug log?
    this? **/storage/logs/laravel.log**?
    
    or I should check my server's website error/access logs?

    How do I enable debug mode? I have this in my .env file:

    APP_DEBUG=true APP_LOG_LEVEL=debug

    is my debug mode enabled and where do I check the debug log? this? /storage/logs/laravel.log?

    or I should check my server's website error/access logs?

  • devdojo 2 years ago
    If you've enabled debug mode you should be able to right-click one of the broken images and then say 'Open in New Tab' that new page will show the error message.
    
    Additionally, if you wanted to share your URL here I can help investigate this issue further :)
    
    Thanks.

    If you've enabled debug mode you should be able to right-click one of the broken images and then say 'Open in New Tab' that new page will show the error message.

    Additionally, if you wanted to share your URL here I can help investigate this issue further :)

    Thanks.

  • stantyan 2 years ago
    I'm just getting a 404 not found error. I guess this has something to do with my nginx server configuration. I have followed all laravel's guide to config this nginx setup. For example pretty urls are working ok.
    
    Have you tested GeekShop on nginx server?
    
    Sorry, website is not publicly available yet. I'm working on a remote server by changing my local hosts records. If you want I can email you IP address for DNS.

    I'm just getting a 404 not found error. I guess this has something to do with my nginx server configuration. I have followed all laravel's guide to config this nginx setup. For example pretty urls are working ok.

    Have you tested GeekShop on nginx server?

    Sorry, website is not publicly available yet. I'm working on a remote server by changing my local hosts records. If you want I can email you IP address for DNS.

  • stantyan 2 years ago
    I've read Glide library uses GD library or imagick, I have checked with my php.ini and php info, and both of them are installed and enabled on my server.

    I've read Glide library uses GD library or imagick, I have checked with my php.ini and php info, and both of them are installed and enabled on my server.

  • devdojo 2 years ago
    Yeah, that's strange. I've tested this on Homestead which uses Nginx and it was working just fine on my end.
    
    Were you able to get an error message by right clicking on the image and showing in new tab. Let me know :)
    
    Thanks.

    Yeah, that's strange. I've tested this on Homestead which uses Nginx and it was working just fine on my end.

    Were you able to get an error message by right clicking on the image and showing in new tab. Let me know :)

    Thanks.

  • stantyan 2 years ago
    There is no any laravel debug error message. There is just plain 404 not found browser error.
    I've made website public. can you please check what's wrong.

    There is no any laravel debug error message. There is just plain 404 not found browser error. I've made website public. can you please check what's wrong.

  • devdojo 2 years ago
    Awesome, thanks for getting it up on a server. So, I found this article: url, which it looks like someone else was having this issue with nginx and the glide library. If you scroll down to the bottom it looks like someone posted a solution to this which was to add the following nginx rules in your nginx config:
    
    ```
    # Pass request to Laravel if static image can not be found
    location ~ ^/(img|photos)/ {
      location ~* \.(?:jpg|jpeg|gif|png)$ {
        expires 1y;
        access_log off;
        add_header Cache-Control "public";
    
        try_files $uri $uri/ /index.php?$query_string;
      }
    }
    ```
    
    If you could add that to your nginx config and restart nginx, I think that might resolve it :)
    
    But if it does not can you go ahead and send me a message with your server info and I can login and try and help you further.
    
    Thanks!

    Awesome, thanks for getting it up on a server. So, I found this article: url, which it looks like someone else was having this issue with nginx and the glide library. If you scroll down to the bottom it looks like someone posted a solution to this which was to add the following nginx rules in your nginx config:

    # Pass request to Laravel if static image can not be found
    location ~ ^/(img|photos)/ {
      location ~* \.(?:jpg|jpeg|gif|png)$ {
        expires 1y;
        access_log off;
        add_header Cache-Control "public";
    
        try_files $uri $uri/ /index.php?$query_string;
      }
    }
    

    If you could add that to your nginx config and restart nginx, I think that might resolve it :)

    But if it does not can you go ahead and send me a message with your server info and I can login and try and help you further.

    Thanks!

  • stantyan 2 years ago
    Hi, thank you so much for a great support, but this did not help :(
    
    Also, I cannot share the server info... my company prohibits this practice. 
    
    I was Googling this issue, but could not find anything related to nginx and this Glide library. I'm not demanding anything, to be honest I'm really thankful for your amazing support, but if you will find solution to this problem in near future, please let me know.

    Hi, thank you so much for a great support, but this did not help :(

    Also, I cannot share the server info... my company prohibits this practice.

    I was Googling this issue, but could not find anything related to nginx and this Glide library. I'm not demanding anything, to be honest I'm really thankful for your amazing support, but if you will find solution to this problem in near future, please let me know.

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
Want to create your own SAAS?

I can teach you to create your own Software as a Service. Click here to learn more!

Visit SAAS Adventure!