CodeSleeve / asset-pipeline

This Laravel 4 package provides a very simple and easy to use asset pipeline. It was heavily inspired by the Rails asset pipeline. We make use of the wonderful Assetic package to help with pre-compliation!
http://www.codesleeve.com
MIT License
489 stars 53 forks source link

[Question] How to prevent image_tag() from printing HTML code? #130

Closed Fractaliste closed 10 years ago

Fractaliste commented 10 years ago

I'm using an equivalent of BBCode syntax and I need to prepare my HTML code before output it.

I would like to use your image_tag() function to prepare my images, but the function immediately print the image instead of returning the <img src> string.

Is it possible to easily change this comportment ? (like 2nd print_r() function argument or providing a image_url() function maybe?)

kdocki commented 10 years ago

Yeah, in the config.php you can create your own image_tag composer and use it instead.

You can make it return anything you want instead of printing. Or you can handle the processing of the image_tag() inside of the composer and print from there. It is completely up to you.

Use this as a base case to write your own ImageComposer.

Please re-open this issue if you have any other questions.

Fractaliste commented 10 years ago

Thanks for your tips, it works fine.

I've registered my custom imageTag class with the autoLoader array in my composer.json file, is there any more recommended way to do it?