Intervention / imagecache

Caching extension for the Intervention Image Class

Home Page:https://image.intervention.io/v2/usage/cache

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange - getting 404 response even though image is returned

simplenotezy opened this issue · comments

I am getting a 404 response, see: https://athliit.com/images/cover_thumbnail/90271b285b66934460d8a5543fa5aceb.jpg

Even though the images is loaded and returned. Why is this?

It only happens on production. On our local machine images return 200.

Why is this happening? Anyone?

image

Try to change your custom templates for an folder insider your App.
Create App\Filters
then create your filters file only with chars, without numbers.
'templates' => array( 'small' => 'Intervention\Image\Templates\Small', 'medium' => 'Intervention\Image\Templates\Medium', 'large' => 'Intervention\Image\Templates\Large', 'thumb' => 'App\Filters\Thumb', 'slider' => 'App\Filters\Slider' ),

Example of mine config.

And one of my filters:
<?php
namespace App\Filters;

use Intervention\Image\Image;
use Intervention\Image\Filters\FilterInterface;

class Thumb implements FilterInterface
{
    public function applyFilter(Image $image)
    {
        return $image->fit(260, 160)->encode('jpg',68);
    }
}

My problem was the name of folder in config. I put App\filters
the name of my folder is App\Filters

Seems to be Case Sensitive, so be carefull

I haven't tried this, but I don't think this would solve the issue. Remember that my templates are found, and images are returned as they should, however, a 404 response code is also returned, confusing the browsers and search engines.

It works on my staging and development environments, it's only on production it won't work.

I wonder if this has anything to do with my nginx setup? I would love to get some pointers so I can debug this further. I am lost, and considering switching to another photo handling library.

I found it it was an nginx configuration:

   location ~*  \.(jpg|jpeg|svg|png|gif|ico|css|js)$ {
           expires 31d;
   }

Hey, could you explain it a little bit abount nginx configuration, thank you