Code Monkey home page Code Monkey logo

avalancheimaginebundle's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avalancheimaginebundle's Issues

Error updating to the latest version

I have updated Symfony2 using "php bin/vendors update", and when it gets to AvalancheImagineBundle it gives this error:

> Installing/Updating AvalancheImagineBundle
HEAD is now at 1b7d587 Merge pull request #27 from skeud/fix_doc_typo



  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "secure_controllers" under "jms_security_extra"           






  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "secure_controllers" under "jms_security_extra"

With Thumbnail filter is it possible to set only one dimension?

Hi,
If I would like to create a filter that resize only for width (for example), how could I do it?
I tryed with:

test1:
  type:    thumbnail
  options: { size: [300, null], mode: inset }
test2:
  type:    thumbnail
  options: { size: [300, ], mode: inset }

Any suggestion?
Or should I create a custom filter?

Fat ImagineController

Here is the scenario.

I want to serve filtered images from my controller using awesome IgorwFileServeBundle.

So, what should I do? I should copy paste filterAction and make it work for me.

But as you can see, there is a lot of code, and it would be perfect if some of this functionality is extracted from ImagineController in order to be reused.

It would be nice if something like this is possible:

$cachedPath = $imagineCacheManager->cacheImage($path, $filter);

It should always return path to cached image so it can be served right after.

Route "_imagine_my_thumb" does not exist

when i try the default plugin in the README, i get

An exception has been thrown during the rendering of a template ("Route "_imagine_my_thumb" does not exist.")

i am on Symfony 2.0.11

Add support for several filters in one filter set

Currently in configuration we can specify only one filter in filter set. E.g.:

avalanche_imagine:
    filters:
        my_thumb:
            type:    thumbnail
            options: { size: [120, 90], mode: outbound }

We should allow specifiying several filters in one filter set (e.g. resize the image and add watermark). For example:

avalanche_imagine:
    filters:
        my_thumb:
            thumbnail:
                options: { size: [120, 90], mode: outbound }
            other_filter: ~
            other_filter2: ~

Images keep showing as broken links

Hi,

on my local developement machine, as well as on the live server....most of the images keep showing as broken links....around 70% The rest shows normally.

Ability to serve images from database or s3?

Hi,

I've got a setup where I cannot rely on user uploaded images being on disk, users upload images and I'm storing the file data and mimetype in the database, resizing them and then passing them along to s3.

Have you considered a similar approach?

Cheers

support an optional service to build the image instance in the Controller

we dont store our images in the file system, instead we store it in a content repository. it would help us therefore if the controller could be refactored a bit to make it possible to optionally define a service that creates the imagine instance, rather than the hardcoded file system approach.

Apply a filter within Controller

Hi, it is possible to apply a filter within Controller? I have found these link:
#35
#62

I have 'my_thumb' filter (app/config.yml) and within a Controller (called via AJAX) I have an array of paths. I would apply 'my_thumb' filter for each element of this array so I can return (via JSON) the list of original photos and created thumbnails.

Thank you in advance,
Emanuele

Issue when concatenating

Hi,

I'm not sure if this is a bug, but when I do this it works:

<img src="{{  '/assets/images/vendor/E2682014-3133-F0AA-925B-FDE083A9B127.jpg' | apply_filter('thumb_medium') }}" width="300" height="300">

But this doesn't work:

<img src="{{  '/assets/images/vendor/' ~ 'E2682014-3133-F0AA-925B-FDE083A9B127.jpg' | apply_filter('thumb_medium') }}" width="300" height="300">

Thanks

Add Composer.json

{
    "name": "avalanche123/imagine-bundle",
    "description": "Image manipulation using Imagine and Twig Filters.",
    "keywords": ["image manipulation", "imagine"],
    "homepage": "https://github.com/avalanche123/AvalancheImagineBundle",
    "type": "symfony-bundle",
    "license": "MIT",
    "authors": [
        {
            "name": "Bulat Shakirzyanov",
            "email": "[email protected]",
            "homepage": "http://avalanche123.com"
        }
    ],
    "require": {
        "symfony/framework-bundle": "2.*",
        "imagine/Imagine": "dev-master"
    },
    "suggest": {
        "symfony/twig-bundle": "2.*"
    },
    "autoload": {
        "psr-0": { "Avalanche\\Bundle\\ImagineBundle": "" }
    },
    "target-dir": "Avalanche/Bundle/ImagineBundle"
}

Issue with type hinting in controller?

Hello, trying to use bundle to generate thumbnails.

But got this error:

Catchable Fatal Error: Argument 5 passed to Avalanche\Bundle\ImagineBundle\Controller\ImagineController::__construct() must be an instance of Symfony\Component\Filesystem\Filesystem, instance of Symfony\Component\HttpKernel\Util\Filesystem given, called in /project/app/cache/dev/appDevDebugProjectContainer.php on line 969 and defined in /project/vendor/bundles/Avalanche/Bundle/ImagineBundle/Controller/ImagineController.php line 60

It seems like last commit does not suite with generated appDevDebugProjectContainer.php.

Problem with first time displaying of thumbnails

Hi ! I've just installed the bundle but strange error occurs, haven't seen such reported here so I'm writing about it:
The first time thumbnail is called the image doesn't show up - instead it says:

"The image http://www.bla.com/bla.jpg cannot be displayed because it contains errors"
The status of the response is "201 Created"

After the first refresh of the page the image is fine.

Multiple filters apply to one image

How does it possible? For example, I'm creating "grayscale" filter and want to apply it to my image and then thumb it to 800x600. May be it's not actually Imagine issue, but when I'm simple doing multiple filters in Twig, Imagine obviously doesn't find source at second step (because URL returned with /my_project/app_dev.php/ and so on prefix).
Any ideas? Thanks.

Image links are broken when receiving them from cache

If a file (thumbnail filter used) does not exist in the cache, it will be generated, placed at the what I would say correct folder and then displayed on the page.
But when I reload the page, the image link is broken. I used the debugger and it says, that the realPath exists and he makes a redirect. This new url does not have my app_dev.php in it anymore and the link is broken.

 if (file_exists($realPath)) {
            return new Response('', 301, array(
                'location' => $this->request->getBasePath().$browserPath
            ));
        }

This is because it redirects always to the same part of the controller.

Here is my config:

avalanche_imagine:
    web_root:     %kernel.root_dir%/../web/images/persons/
    source_root:     %kernel.root_dir%/../web/images/persons/

    filters:
        my_thumbnail:
            type:    thumbnail
            options: { size: [120, 90], mode: outbound }

Is this a bug or am I doing anything wrong?

BC-Break: Filesystem and Symfony-2.0.x

Due to the recent changes regarding the new Filesystem-Component (2187ee4 and 2ab28a2), the Bundle is no more compatible with 2.0.x-Versions of Symfony. Even if no further support for those versions is planned, there should at least be a tag one can check out when Symfony 2.0.x is used.

Twig filter doesn't work with full qualified URLs

The following code doesn't work :

<img src="{{ 'http://img.mydomain.tld/picture.jpg'|apply_filter('avatar_s') }}" class="avatar" alt="" />

The output is :

<img src="/media/cache/avatar_s/http://img.mydomain.tld/picture.jpg" class="avatar" alt="">

Can't work ;-)

Change the cache directory

Hi,

There is an easy way to change the cache directory(web/media/cache) without change the imagine.xml file?

I tried something like this on the symfony config.yml file:

avalanche_imagine:
source_root: %kernel.root_dir%/cache
web_root: %kernel.root_dir%/cache
cache_prefix: img/thubmnails

But It didn't work.

Kind Regards!

imagealphablending(): 5 is not a valid Image resource

Hi, i have this problem when trying to write some text on the image loaded:

        $image=new Imagine\Gd\Imagine();

        $color = new Imagine\Image\Color('#900');
        $fontFile = 'path/to/myfont.ttf';
        $font=new Imagine\Gd\Font($fontFile, 14, $color);
        $point=new Imagine\Image\Point(0, 0);

        $image->open('path/to/image.jpg')
                ->draw()
                ->text('my test text', $font, $point);

        $image->save('path/to/new-image.jpg');

The error happens on ... Gd\Drawer, line 232. Debugging that i saw that the $resource is destroyed (i dont know why) just before the text() function to be called.

Is it a bug or am I missing something? I could not found _any_ complete example of write some text using Imagine.

Thank you so much and congrats for the great lib.

Refactor LoaderInterface.php to support more types of data sources

Seeing that ImagineInterface offers a load($string) function which loads an image file from a string of binary data, it would be great to be able to use such sources in LoaderInterface.php and return content from them without first creating a local file. In my case I need to retrieve and render images from a remote storage on the fly for which no direct filesystem access is available (only via an API). Since LoaderInterface currently only supports local files I cannot use the AvalancheImagineBundle.

It would also be useful to have php://memory and php://temp I/O stream support, however I can read into a binary data string from those myself so it is not that critical.

Fatal error occurs, if there is no imageantialias functioin

imageantialias function does not exist in all PHP installations.
The library must handle such situations.
In fact it does, but I've just got Fatal error on Ubuntu 11.04, with PHP installed from ubuntu repo.

Fatal error: Call to undefined function Imagine\Gd\imageantialias() in /home/entea/PhpstormProjects/leadgenerator/vendor/imagine/lib/Imagine/Gd/Image.php on line 585

Call Stack:
0.0001 328804 1. {main}() /home/entea/PhpstormProjects/leadgenerator/web/app_dev.php:0
0.0166 1221316 2. Symfony\Component\HttpKernel\Kernel->handle() /home/entea/PhpstormProjects/leadgenerator/web/app_dev.php:20
0.0402 1547668 3. Symfony\Bundle\FrameworkBundle\HttpKernel->handle() /home/entea/PhpstormProjects/leadgenerator/app/bootstrap.php.cache:547
0.0403 1548200 4. Symfony\Component\HttpKernel\HttpKernel->handle() /home/entea/PhpstormProjects/leadgenerator/app/cache/dev/classes.php:4828
0.0403 1548200 5. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/entea/PhpstormProjects/leadgenerator/app/cache/dev/classes.php:3849
0.0906 1784368 6. call_user_func_array() /home/entea/PhpstormProjects/leadgenerator/app/cache/dev/classes.php:3879
0.0906 1784560 7. Maggots\LeadGeneratorBundle\Controller\UploadController->uploadPhotoAction() /home/entea/PhpstormProjects/leadgenerator/app/cache/dev/classes.php:0
0.9010 2682420 8. Imagine\Gd\Image->thumbnail() /home/entea/PhpstormProjects/leadgenerator/src/Maggots/LeadGeneratorBundle/Controller/UploadController.php:37
0.9011 2682868 9. Imagine\Gd\Image->copy() /home/entea/PhpstormProjects/leadgenerator/vendor/imagine/lib/Imagine/Gd/Image.php:298
0.9011 2683404 10. Imagine\Gd\Image->createImage() /home/entea/PhpstormProjects/leadgenerator/vendor/imagine/lib/Imagine/Gd/Image.php:62

Problem to install

I don't succes to install this bundle in SF 2.2.
My steps for install it:

I have add in my composer.json:

"imagine/Imagine": "dev-master"

and run the command:

app/console composer.phar update

No problem for the moment.

In my AppKernel.php:

new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),

In my routing.yml, I add:

_imagine:
    resource: .
    type:     imagine

After that, I have add in my config.yml:

# AvalancheBundle
avalanche_imagine:
    filters:
        my_thumb:
            type:    thumbnail
            options: { size: [120, 90], mode: outbound }

In my browser I have this error:

Fatal error: Class 'Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle' not found in .../app/AppKernel.php on line 23

Where is my error?

Thanks for advance

Observation: I haven't found the file AvalancheImagineBundle.php ?!

Dynamic options for Imagine filter

It's not possible to provide options to Imagine filter through a route. E.g. set an image size dynamically:

/media/cache/filter/path/to/my/file/file-800-600.png

for file

/path/to/my/file/file.png

My proposal is to add one more parameter in AvalancheImagineBundle configuration:

avalanche_imagine:
    filters:
        dynamic_size:
            type:    thumbnail
            options: { mode: outbound } #static options
            route: {directory}/{file}-{width}-{height}.{extension} #optional parameter
            #route: {directory}/{file}.{extension} #default setting of route parameter

Directory, file and extension parameters in the route are built-in and create the path to the file. Other parameters are sent to the filter, width and height are sent to the thumbnail filter in this case.
Twig filter could look like this:

'path/to/my/file/file.png'|apply_filter('dynamic_size', {width: 800, height: 600})

This solution has also one security issue - allows attacker to create huge amount of cached files. It could be solved with some constant number determinig the maximum number of possible caches per one image file.
What do you think about this? If you'll like this proposal I can make a pull request.

Peter

Parse error: syntax error, unexpected T_DOUBLE_ARROW

I think that there is an internal error in the Bundle.

When I do : Composer Update
I get the following error:

PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /var/www/workspace/sdfs2.0/vendor/avalanche123/imagine-bundle/Avalanche/Bundle/ImagineBundle/Controller/ImagineController.php on line 136

Parse error: syntax error, unexpected T_DOUBLE_ARROW in /var/www/workspace/sdfs2.0/vendor/avalanche123/imagine-bundle/Avalanche/Bundle/ImagineBundle/Controller/ImagineController.php on line 136

In my composer.json I have:

"require": {
    "symfony/framework-standard-edition": "2.1.*",
    "friendsofsymfony/facebook-bundle": "dev-master",
    "friendsofsymfony/user-bundle" : "*",
    "friendsofsymfony/comment-bundle" : "2.0.x",
    "friendsofsymfony/rest-bundle" : "dev-master",
    "jms/serializer-bundle": "0.9.0",
    "sonata-project/admin-bundle" : "dev-master",
    "sonata-project/doctrine-orm-admin-bundle" : "dev-master",    
    "sonata-project/user-bundle" : "dev-master",
    "knplabs/knp-paginator-bundle" : "dev-master",
    "avalanche123/imagine-bundle" : "dev-master",
    "sensio/distribution-bundle": "2.1.*",
        "sensio/framework-extra-bundle": "2.1.*",
        "sensio/generator-bundle": "2.1.*",
        "jms/security-extra-bundle": "1.2.*",
        "jms/di-extra-bundle": "1.1.*"

},
"scripts": {
    "post-install-cmd": [
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
       "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"minimum-stability": "dev"
}

And in my appKernerl:

public function registerBundles()
    {
        $bundles = array(
        .....
        new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),

How specify two source_root ??

Hello, I need any help.

I have two filters: persons and dogs for example.

The filter dogs has to recuperate the images in source_root: %kernel.root_dir%/../web/uploads/dogs

And the filter persons in source_root: %kernel.root_dir%/../web/uploads/persons

Each of the filter also has that save the images in diferents directories.

I did:

avalanche_imagine:
    cache_prefix: uploads/avalanche
    filters:
        persons:
            type:    thumbnail
            options: { size: [120, 90], mode: outbound, quality: 100, format: jpg }
            source_root:  %kernel.root_dir%/../web/uploads/persons
            web_root:     %kernel.root_dir%/../web/uploads
            driver:       gd
        dogs:
            type:    thumbnail
            options: { size: [240, 200] }
            source_root:  %kernel.root_dir%/../web/uploads/dogs
            web_root:     %kernel.root_dir%/../web/uploads
            driver:       gd

But it doesnt work!!

Nginx config for this

Hi,
I am a newbiw with nginx but i found out howto do it with this bundle:

location = /favicon.ico {
        log_not_found off;
        access_log off;
}

location ~ /\.ht {
        deny all;
}

location ~ \.((^\/media\/cache.*)|(php($|/))) {
        include fastcgi_params;

        set $script $uri;
        set $path_info "";

        if ($uri ~ "^(.*cache.*)") {
                set $script "app.php";
                set $path_info $1;
        }
        if ($uri ~ "^(.+\.php)(/.+)") {
                set $script $1;
                set $path_info $2;
        }

        fastcgi_param SCRIPT_NAME $script;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
}

but is this a good solution or do you see a better?
are my static files even served by nginx?
Probably it would be nice to include such a example config in the doc.

Cheers PHil

Update to Symfony2.1

Hello!
I have updated my project to symfony2.1, but Avalanche Image Bundle doesnt work.
In my appkernel.php I wrote:
public function registerBundles()
{
$bundles = array(
(...)
new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),
);
(...)

In my composer.json I wrote:
require "avalanche123/imagine-bundle" : "dev-master",

When I do: composer install
I get the following error:

Loading composer repositories with package information
Installing dependencies from lock file
Your lock file is out of sync with your composer.json, run "composer.phar update" to update dependencies
Nothing to install or update
Generating autoload files
PHP Fatal error: Class 'Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle' not found in /var/www/workspace/sdfs2.0/app/AppKernel.php on line 35

Fatal error: Class 'Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle' not found in /var/www/workspace/sdfs2.0/app/AppKernel.php on line 35

When I do: composer update
I get the following error:
Loading composer repositories with package information
Updating dependencies

  • Updating imagine/imagine (v0.3.0 => dev-master v0.3.0)

    [RuntimeException]
    Source directory /var/www/workspace/project2.0/vendor/imagine/Imagine has uncommitted changes.

In my browser I see the following error:
Fatal error: Class 'Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle' not found in /var/www/workspace/project2.0/app/AppKernel.php on line 35
( line 35 is new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(), )

Anyone can help me ? Thanks :)

Routes doesn't create

Hi,

I have a bug with the bundle.
I use Symfony v2.1.2 and AvalancheImagineBundle v2.1.
My config is fine
avalanche_imagine:
driver: gd
filters:
miniature:
type: thumbnail
options: { size: [120, 120], mode: inbound }

But the routes are not created, i don't locate the bug

Bundle is in AppKernel
new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),

Clearing cache and restart web server doesn't work

Thanks for your help

Code snippet to apply filter whereever Kernel is available?

I think it would be useful for much applications. Have someone this snippet? I'm a bit confused in ImagineBundle internal structure and think can't properly initialize objects to work with parameters. This parameters are image path and filter name (provided in configuration). If someone could help, I will very appreciate this. For now my variant (unworking) is

        $imagineFilterManager->get($filterName)
            ->apply($this->imagine->open($image->getAbsolutePath()))
            ->save(
                urldecode(urldecode($imagineCachePathResolver->getBrowserPath($image->getWebPath(), $filterName))),
                array('quality' => $imagineFilterManager->getOption($filterName, "quality", 100))
            );

Prevent image cropping in `outbound` mode

Is there some way to prevent image cropping in outbound mode?

If I have for example 800x600 image, and I apply 600x600 filter, can I prevent cropping, but get image resized to 600x451?

applying "resize" filter

Let's put I want a 200x200 thumbnail starting from an image. So I set the config.yml in this way:

avalanche_imagine:
    web_root:     %kernel.root_dir%/../web
    filters:
        inset_200_200:
            type:    thumbnail
            options: { size: [200, 200], mode: inset }

and everything works well with images bigger than 200x200, because it will resize the original image depending on the max dimension: height or width.

The problem raises when the original image is smaller than 200x200, e.g. 50x50. In this case the image is stretched, until at least one dimension reaches 200. I want that smaller images than 200x200 are not resized at all.

So I tried in config.yml:

avalanche_imagine:
    web_root:     %kernel.root_dir%/../web
    filters:
        resize_200_200:
            type:    resize
            options: { size: [200, 200] }

looking at Imagine documentation page found here: http://imagine.readthedocs.org/en/latest/api/Image/manipulator_interface.html#Imagine\Image\ManipulatorInterface::flipHorizontally

from that document, I understand I can use resizefilter with sizeoption, in the same way I can use thumbnailfilter with sizeand modeoptions.

But this does not work, the thumbnail is not created at all. Anyone already tried to do this? Any suggestions? thanks

It's not working maaan :(

What I've done:

  • Installed AvalancheImagineBundle & Imagine by adding deps and running php ./bin/vendors install
  • Updated AppKernel.php and autoload.php
  • Updated routing.yml
  • Added thumb filter configuration to config.yml
  • Cache-clear

in config.yml:

avalanche_imagine:
    web_root:     %kernel.root_dir%/../web
    cache_prefix: media/cache
    driver:       gd
    filters:
        thumb:
            type:    thumbnail
            options: { size: [96, 96], mode: outbound }
Given twig code <img src="{{ '/test.png'|apply_filter('thumb') }}" />
When Requesting the page
Then rendered result <img src="/app_dev.php/media/cache/thumb/test.png">

But I see no image. Firebug sais "Failed to load given URL". When I check in my /web directory - file "/web/media/cache/thumb/test.png does not exist.

What am I doing wrong?

Symfony 2.0 support

Can you create a branch 2.0 instead of a tag ? if we found a bug with Symfony2.0 it will be easier to fix it

Provide width and height in template

when writing an image tag into the html output as in <img src="{{ image_path|apply_filter('small') }}" width="?" height="?" alt="{{ image_alt }}" />
it would be nice to be able to specify the width and height attributes but without duplicating the configuration info. or is there some way to do this and i just don't see it?

Exception thrown when applying filter for first time

When applying a new filter for the first time (or applying an existing filter to an image in a new file path), the image is not displayed correctly. Refresh the page and it appears fine. An exception is thrown on the first attempt:

Could not create directory /var/www/html/testapp5/app/../web/media/cache/thumb/uploads/artist_images

in /var/www/html/testapp5/vendor/avalanche123/imagine-bundle/Avalanche/Bundle/ImagineBundle/Controller/ImagineController.php at line 123

    if (!is_dir($dir)) {
        if (!$this->filesystem->mkdir($dir)) {
            throw new \RuntimeException(sprintf(
                'Could not create directory %s', $dir
            ));
        }

I think this is caused because Filesystem->mkdir no longer returns a boolean (it throws an exception if it failed instead). I could have a go at creating a pull request - i'm pretty new to git/symfony, so you might have to bare with me!

Type "relative_resize" doesn't work

Hi,

I am on the Symfony 2.1 version, I'm using the v2.1 version of AvalancheImagineBundle, but when I set my filter with "relative_resize" type, as below

avalanche_imagine:
    filters:
        profile_show:
            type: relative_resize
            options: { widen: 170 }

This code doesn't work, but when I try with another type like "thumbnail" or "resize", it's works fine.

The list of directory has been created and the path of the file is correct (/app_dev.php/media/cache/profile_show/photos/5_profile.png), but the image has not been created.

Thanks.

[feature request] Keep full image/ aspect ratio on filters

Sorry if this isn't the right place for this. But I haven't seen or figured out a way to do this. I'd like to create a filter that sets the max width, and resizes solely on that value. The goal would be to keep the full image and aspect ratio, and resize it down based on the width or height specified.

Add configurable jpeg quality

When the bundle handles a thumbnail filter, it's quality is hardcoded to value 100. But for jpegs it is not good at all.
I've looked the code and understood that filter's config is not accessible from the controller directly.
Could you add a config parameter for quality? Or there are only png-oriented thumbnails?

ImagineController.php on line 130:

->save($realPath, array('quality' => 100))
->show('png');

Creating images breaks FastCGI

Upon creation of the resized image, a response with status code 500 and containing text "201 Created" is returned to the client. Image shows as broken in HTML page.
Apache log says:

FastCGI: comm with server "/var/www/cgi-bin/php-cgi-5.3.3" aborted: error parsing headers: duplicate
header 'content-type'

Apart from breaking FastCGI, this is also violating RFC2616, which allows multiple content-type header only in

  • a "300 Multiple Choice" response for agent-drive negotiation, or
  • within multi-part content.

The action in controller sends proper content-type headers. Any idea what could be sending "content-type: text/html" header before "return new Response()" line? I'm thinking output buffering, will try and take a better look.

Security bug

My app structure:

  • app
  • src
  • vendor
  • .........
  • web
    • images
      • image1.jpg
  • image2.jpg

image1.jpg is accessible and image2.jpg is not accessible.
But with "/media/cache/my_thumb/../image2.jpg", image2.jpg is accessible! We can read files that are outside the web directory...

Use stable version

Hi there.
If this bundle is stable, or near to be stable, can you please create a new tag named "1.0.0" ?
Also, can you use a stable version of Imagine dependency ? Like 0.3.0 ?

Add more easy to use thumb tags

Right now I have configuration like

avalanche_imagine:
    web_root:     %kernel.root_dir%/../web
    cache_prefix: media/cache
    driver:       gd
    filters:
        637_355:
            type:    thumbnail
            options: { size: [637, 355], mode: outbound }
        640_360:
            type:    thumbnail
            options: { size: [641, 360], mode: outbound }
        289_214:
            type:    thumbnail
            options: { size: [289, 214], mode: outbound }
        75_64:
            type:    thumbnail
            options: { size: [75, 64], mode: outbound }
        152_128:
            type:    thumbnail
            options: { size: [152, 128], mode: outbound }
        152_94:
            type:    thumbnail
            options: { size: [152, 94], mode: outbound }
        47_47:
            type:    thumbnail
            options: { size: [47, 47], mode: outbound }
        115_65:
            type:    thumbnail
            options: { size: [115, 65], mode: outbound }
        30_30:
            type:    thumbnail
            options: { size: [30, 30], mode: outbound }
        20_20:
            type:    thumbnail
            options: { size: [20, 20], mode: outbound }

and in my code I use code like

{{ article_screenshot(magazineArticle) | apply_filter("152_94")}}

My question is - whats point of the creation entries in config?
everything would be simpler with implementation like

{{ article_screenshot(magazineArticle) | thumb(152,94)}}

and no configuration.

Is it possible? :)

("Route "_imagine_my_thumb" does not exist.")

I'm getting the same error.
Did a clean install of AvalancheImagineBundle.

Getting this error:

Configuration:

avalanche_imagine:
filters:
my_thumb:
type: thumbnail
options: { size: [120, 90], mode: outbound }

In Twig:

<img src="{{asset(image.getWebPath) | apply_filter('my_thumb') }}" />

An exception has been thrown during the rendering of a template ("Route "_imagine_my_thumb" does not exist.")

Upscaling small images bug

Hi, I have a filter 250

    filters:
        250:
            type:    thumbnail
            options: { size: [250, 250], mode: inset, quality: 70, format: jpg }

which should resize the images 250x250 pixels and this works... but It appears that if the source image is smaller let's say 50x50 pixels the bundle upscales the image to 250x250 which i think is quite wrong. It should not upscale small images at all.

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.