-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
asset-pipeline for laravel 4.0 #128
Comments
Give him a break. It's only been 3 hours! |
sorry @GrahamCampbell .. can you suggest anything on this issue |
I don't personally use this package, but it looks like any version is compatible judging by the composer requirement of "4.x". If you want the latest stable version of this package, just require it with the version constraint of "1.x@stable". |
@GrahamCampbell .. thanks .. can i implement image optimization using the asset-pipeline.. or any better framework is there |
Maybe https://github.com/orchestral/imagine would be of some use? |
@aditya- You should be able to use the latest version with Laravel 4.0 or 4.1 |
@kdocki .. thanks .. bt can i optimize my images using this asset-pipeline .. if yes ... how to that .. |
No idea how to optimize images. You might try using that library GrahamCampbell mentioned above though. |
@aditya- That library I gave you won't optimize them straight off. You will need to write your own code to do it. |
@kdocki @GrahamCampbell .. i saw this .. https://gist.github.com/Spir/5650030 which is based assetic .. its an image optimization gist file .. i am unable to make it work ... but its good one .. can you please look |
@Spir can you specify usage instruction .. where i need to keep this in laravel .. as i am getting Class 'Illuminate\Console\Command' not found .. error .. |
@aditya- that gist I made a while ago is actually triggering shell commands. You first need to install jpegoptim and optipng that are doing the real job. Commands are saved under app/commands so that's where you should save it. The php artisan dump-autoload and don't forget to register the command: |
@Spir ... Thanks its really a great gist .. Actually is assetic image optimization is a bit complex .. becoz we need to do individually .. so to use this first i need to register like in gist file where to give $imagesFolders path ... how to give like relative path or absolute path ... Please let me know .. Thank you |
Yeap add folders that contains images like: $imagesFolders = Array(
public_path().'/photos/',
public_path().'/some_more_images/'
); Then you can do "php artisan list" and see if the command is listed. Then you can launch image optimizations : php artisan ImageOptimize |
Awesome @Spir .. Thanks for the lovely script .. i will try this .. |
Added some documentation about this for other eyes. Image optimization is a cool thing to do to your assets but as you can see it is probably best for it to be done separately from the pipeline and then just include optimized images into the pipeline. |
@Spir it was working awesome .. today i checked it ... but it lacks when optimizing sub folders ... how to do this optimization in recursive mode .. like suppose directories are like this : assets/images/pics i declared like this
its optimizing only images and its ignoring pics folder .. how to do this optimization in recursive mode. |
The man page for jpeginfo say there are no recursive solution: That's the reason why you have to declare every folder unfortunately. |
yeah @Spir i am trying to implement some thing like this
which is not working .. i seen this at https://github.com/glennr/jpegoptim can you give any ideas ? another ref : http://www.networkinghowtos.com/howto/optimizing-jpeg-image-files-on-linux/ |
There is a nice idea on that last link you gave: exec('find '.$imagesFolder.' -name *.jpg | xargs jpegoptim --strip-all'); You can almost do the same for PNG: exec('find '.$imagesFolder.' -name *.png | xargs optipng '); The first link is a fork that you need to install on your own. |
Hi , @Spir thanks for fast response .. here i given like this :
but i am getting syntax error :
can you please suggest |
@aditya- your single quotes inside of the bash command needs to be escaped like so // jpeg optimization
foreach($imagesFolders as $imagesFolder)
{
exec('find . -name \'*.jpg\' | xargs jpegoptim --max=95 --strip-all --all-progressive '.$imagesFolder.'*');
}
$this->info('jpeg optimization done'); |
@felixkiss .. Really thanks for the idea .. after executing i am getting this output
its showing it cant access some folders but its optimizing those folders in background ... its working in background .. taking all images in the project @Spir .. i think instead of declaring paths ... like
its better to give complete app folder .. so that it will searches all images may be .... like
can be done ? i am getting some errors |
it looks like you have some broken images |
@Spir and all the contributors, thank you so much for your help |
everything is working fine now |
Hi @kdocki
i am using laravel 4.0 . i am using older version of asset-pipeline .. @kdocki can you please suggest some latest stable version of asset-pipeline which is compatible with laravel 4.0 . How to upgrade from old ?
can i optimize my images using this asset-pipeline .. if yes ... how to that ..
Thanks in advance
The text was updated successfully, but these errors were encountered: