Skip to content
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

Road to v1 #31

Open
4 tasks
dmongeau opened this issue Dec 31, 2016 · 2 comments
Open
4 tasks

Road to v1 #31

dmongeau opened this issue Dec 31, 2016 · 2 comments

Comments

@dmongeau
Copy link
Member

The development of version 1.0 is currently in ongoing in the branch v1.

Here are the new features:

Sources
The main difference between v1 and prior versions is the support of multiple sources. It make it easy to pull images from a laravel filesystem, or local filesystem or any remote url. You can take a look at the configuration file for a better idea: https://github.com/Folkloreatelier/laravel-image/blob/v1/src/config/image.php.

Basically, you will be able to use the facade on any source, for example:

$image = Image::source('cloud')->make('image-on-cloud.jpg', [
    'width' => 100,
    'height' => 100
]);

Image::source('cloud')->save($image, 'image-on-cloud-thumbnail.jpg');

Filters
Filters has been moved to classes and are now declared in the configuration file. It still support closure and array of other filters.

Routes
You can define multiple routes with lots of options. Here is an example of the configuration for the default route:

    'routes' => [
        'default' => [
            // The path of the route. {pattern} will be replaced by the url pattern
            // for this route according to the url format.
            'route' => '{pattern}',
            
            // A domain that will be used by the route
            'domain' => null,
            
            // Any middleware you want ot add on the route.
            'middleware' => [],
            
            // The name of the source to get the image. If it is set to null,
            // it will get use the default source.
            'source' => null,
            
            // Allow to specify a size as filter
            'allow_size' => true,
            
            // Allow to specify filters in url. You can also set this to
            // an array of specific filters to restrict this route to those filters.
            // Example: ["negative"]
            'allow_filters' => true,
            
            // Disallow some filters. Can be set to an array of filters.
            'disallow_filters' => false,
            
            // Any url options you want to override.
            'url' => [],
            
            // You can specify base filters that will be applied to any image
            // on this route.
            'filters' => [
                'width' => 100
            ],
            
            // Expires header in seconds
            'expires' => 3600 * 24 * 31,
            
            // Any headers you want to add on the image
            'headers' => [],
            
            // Cache the file on local machine
            'cache' => true,
            
            // The path where the images are stored. It is defined to public path,
            // so the files would be statically served on next request.
            'cache_path' => public_path()
        ]
    ]

URL
The generation of URL is easier and more configurable. You can define a general format that will apply to each routes or override it on each route.

Here is the general config:

    'url' => [
        // The format of the url that will be generated. The {filters} placeholder
        // will be replace by the filters according to the filters_format.
        'format' => '{dirname}/{basename}{filters}.{extension}',
        
        // The format of the filters that will replace {filters} in the
        // url format below. The {filter} placeholder will be replace by
        // each filter according to the filter_format and joined
        // by the filter_separator.
        'filters_format' => '-image({filter})',
        
        // The format of a filter.
        'filter_format' => '{key}({value})',
        
        // The separator for each filter
        'filter_separator' => '-'
    ],

These are the remaining steps before release:

  • Add a source based on url
  • Javascript helper
  • Unit tests
  • Documentation
@vesper8
Copy link

vesper8 commented Mar 21, 2017

planning on starting to use this tomorrow :) very exciting stuff! How's it going with the v1 branch? I see a commit in the last 30 days which always turns me on ;-)

btw I see that the docs only mention compatibility with laravel 5.2

I'm on 5.4, did you notice any breaking changes or not?

Looking forward to more commits!

@ivandokov
Copy link

Any plans to continue supporting this library?
It's really good and I'd like to use it but I don't want to implement abandoned package into my project.

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

No branches or pull requests

3 participants