Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Responsive is not working correctly or perhaps not documented correctly #3

Closed
ghost opened this issue Jul 24, 2013 · 3 comments
Closed

Comments

@ghost
Copy link

ghost commented Jul 24, 2013

Trying to use the ->responsive method and getting a 404 on the image returned. When the ->responsive method is removed, the image works great. Otherwise, the package is great. Keep up the good work! I am using Laravel v4.

@kevbaldwyn
Copy link
Owner

Thank you! Can you post here how you are implementing the responsive method? Maybe the documentation is not correct, or maybe there is a bug, both are possible!!

@vladoa
Copy link

vladoa commented Aug 10, 2013

I can't get this to work at all - I am getting 404 not found on the image returned with something like:

http://localhost/_img?img=/public/images/image.jpg&transform=resizeCrop,400,200

My url config in app.php is: 'http://localhost/laravel'
The image is set in 'public/images/image.jpg'
The imagecow.js is in public/js/imagecow.js

I am including the js like this:

<script type="text/javascript" src="<?php echo Config::get('app.url'); ?>/public/js/Imagecow.js"></script>

and the image like this:

 <img src="{{ Image::path('/public/images/image.jpg', 'resizeCrop', 400, 200) }}" />

and here is my image config:

<?php

return array(

    /**
     * the image worker (GD / Immagick)
     */
    'worker' => 'GD',

    'route' => '/_img',

    /**
     * note this is the server path to the file 
     * from base_path()
     */
    'js_path' => 'public\js\Imagecow.js',

    /**
     * various $_GET variables
     */
    'vars' => array(
        'image'           => 'img',
        'responsive_flag' => 'responsive',
        'transform'       => 'transform'
    ),

    'cache' => array(
        'lifetime' => 1,
        'path'     => 'images' // /app/storage/cache/{images}
    )

);

Could you please advise how to get it to work or what am I missing?

@kevbaldwyn
Copy link
Owner

The package assumes images are in the public directory so prepends the public path to them so you don't need to. You should call your image path as you would any image being rendered in your application as normal (ie without the /public prefix). So your example should be:

<img src="{{ Image::path('/images/image.jpg', 'resizeCrop', 400, 200) }}" />

The same should be for the javascript lib. The package actually includes a method to write the correct script tag (although it's not documented:

{{ Image::js() }}

Just add that in your <head>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants