kevbaldwyn / image

Responsive images and on the fly image sizing for laravel 4 and fuel php
23 stars 13 forks source link

There was an error with the image cache #4

Closed iveoles closed 11 years ago

iveoles commented 11 years ago

I'm receiving an error with the image cache and couldn't see a resolution in the readme.

I have /app/storage/cache set to 777 and there are new files and folders created.

It works on my local Windows machine but not on the CentOS server.

Exception There was an error with the image cache open: /home/appfolder/vendor/kevbaldwyn/image/src/KevBaldwyn/Image/Image.php if($cacheData) {

        // using cache
        if (($string = $cacheData['data']) && ($mimetype = $cacheData['mime'])) {
            header('Content-Type: '.$mimetype);
            die($string);
        }else{
            throw new \Exception('There was an error with the image cache');
        }
iveoles commented 11 years ago

Maybe some further help a log from the cache file. I think it might be a laravel issue :/

[2013-09-03 21:25:06] log.ERROR: exception 'Exception' with message 'There was an error with the image cache' in /home/rvwd/vendor/kevbaldwyn/image/src/KevBaldwyn/Image/Image.php:81 Stack trace:

0 /home/rvwd/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(174): KevBaldwyn\Image\Image->serve()

1 /home/rvwd/vendor/kevbaldwyn/image/src/KevBaldwyn/Image/routes.php(5): Illuminate\Support\Facades\Facade::__callStatic('serve', Array)

2 /home/rvwd/vendor/kevbaldwyn/image/src/KevBaldwyn/Image/routes.php(5): KevBaldwyn\Image\Facades\Image::serve()

3 [internal function]: KevBaldwyn\Image\ImageServiceProvider->{closure}()

4 /home/rvwd/vendor/laravel/framework/src/Illuminate/Routing/Route.php(80): call_user_func_array(Object(Closure), Array)

5 /home/rvwd/vendor/laravel/framework/src/Illuminate/Routing/Route.php(47): Illuminate\Routing\Route->callCallable()

6 /home/rvwd/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1016): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))

7 /home/rvwd/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(530): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

8 /home/rvwd/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(506): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))

9 /home/rvwd/public/index.php(49): Illuminate\Foundation\Application->run()

10 {main} [] []

kevbaldwyn commented 11 years ago

Have you tried clearing the cache folder and reloading?

iveoles commented 11 years ago

Tried but no luck, it regenerates them all, but still doesn't display the images

iveoles commented 11 years ago

It seems to flip with this error (on hitting cache or not hitting cache I assume)

Exception The image file "/home/rvwd/public/images/posts/1/1.jpg" cannot be loaded open: /home/rvwd/vendor/kevbaldwyn/image/src/KevBaldwyn/Image/Image.php 'data' => $this->worker->getString());

        $this->cache->put($checksum, $cacheData, $this->cacheLifetime);

        $this->worker->show();

        // if the script didn't die then it will have an error (Imagecow::show() dies when it returns image data)
        throw new \Exception($this->worker->getError()->getMessage());

    }   
iveoles commented 11 years ago

Hey

Solved the issue. I didn't have Image Magick installed on the server. Might be worth mentioning that it's needed in the readme, although most people do seem to have it.

Thanks for trying to help though, and thanks again for the extension, it's working beautifully now!

Adam

kevbaldwyn commented 11 years ago

Ah yes of course! Sorry, the imagecow library can use both - theres a config option in this package you could have used to specify GD instead. Sorry, this is still very much a work in progress although I've not had much time to re-visit. Documentation is definitely lacking!