Giter VIP home page Giter VIP logo

Comments (3)

kevbaldwyn avatar kevbaldwyn commented on July 26, 2024

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!!

from image.

vladoa avatar vladoa commented on July 26, 2024

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?

from image.

kevbaldwyn avatar kevbaldwyn commented on July 26, 2024

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>

from image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.