<commit_before># Image Package for Laravel 4

This package provides the ability to conveniently work with uploaded images.
It includes an images table and model, and has the ability to provide multiple
versions of the same image with different dimensions, generated on demand.

## Dependencies

This package relies on the [laravel-storage](https://github.com/dmyers/laravel-storage) to manage the image files, which supports writing to the local filesystem or the Amazon S3 service.

## Installation Via Composer

Add this to you composer.json file, in the require object:

```javascript
"mmanos/laravel-image": "dev-master"
```

After that, run composer install to install the package.

Add the service provider to `app/config/app.php`, within the `providers` array.

```php
'providers' => array(
	// ...
	'Mmanos\Image\ImageServiceProvider',
)
```

Add a class alias to `app/config/app.php`, within the `aliases` array.

```php
'aliases' => array(
	// ...
	'Image' => 'Mmanos\Image\Image',
)
```

## Configuration

Publish the default config file to your application so you can make modifications.

```console
$ php artisan config:publish mmanos/laravel-image
```

Run the database migrations for this package.

```console
$ php artisan migrate --package="mmanos/laravel-image"
```

> **Note:** Don't forget to create the writable directory used by the Storage package, if using the local filesystem driver.

## Usage

#### Creating Images

Create an image from image data:

```php
$image = Image::put($contents);
```

Create an image from an uploaded image file:

```php
$image = Image::upload($_FILES['image']);
```

Create an image from a file on the filesystem:

```php
$image = Image::copy($path);
```

Create an image from a URL to an image:

```php
$image = Image::copyUrl($url);
```

#### Using Images

Get URL to the original image:

```php
$url = $image->url();
```

Get URL to image constrained to 128px (best fit, maintaining aspect ratio):

```php
$url = $image->url('128');
```

Get URL to image constrained to 128px in height (maintaining aspect ratio):

```php
$url = $image->url('128h');
```

Get URL to image constrained to 128px in width (maintaining aspect ratio):

```php
$url = $image->url('128w');
```

Get URL to image cropped to a 128px square:

```php
$url = $image->url('128s');
```

> **Note:** You may pass any arbitrary integer value for the image dimension.
<commit_msg>Changed migration command in readme to use publish<commit_after># Image Package for Laravel 4

This package provides the ability to conveniently work with uploaded images.
It includes an images table and model, and has the ability to provide multiple
versions of the same image with different dimensions, generated on demand.

## Dependencies

This package relies on the [laravel-storage](https://github.com/dmyers/laravel-storage) to manage the image files, which supports writing to the local filesystem or the Amazon S3 service.

## Installation Via Composer

Add this to you composer.json file, in the require object:

```javascript
"mmanos/laravel-image": "dev-master"
```

After that, run composer install to install the package.

Add the service provider to `app/config/app.php`, within the `providers` array.

```php
'providers' => array(
	// ...
	'Mmanos\Image\ImageServiceProvider',
)
```

Add a class alias to `app/config/app.php`, within the `aliases` array.

```php
'aliases' => array(
	// ...
	'Image' => 'Mmanos\Image\Image',
)
```

## Configuration

Publish the default config file to your application so you can make modifications.

```console
$ php artisan config:publish mmanos/laravel-image
```

Publish and run the database migrations for this package.

```console
$ php artisan migrate:publish mmanos/laravel-image
$ php artisan migrate
```

> **Note:** Don't forget to create the writable directory used by the Storage package, if using the local filesystem driver.

## Usage

#### Creating Images

Create an image from image data:

```php
$image = Image::put($contents);
```

Create an image from an uploaded image file:

```php
$image = Image::upload($_FILES['image']);
```

Create an image from a file on the filesystem:

```php
$image = Image::copy($path);
```

Create an image from a URL to an image:

```php
$image = Image::copyUrl($url);
```

#### Using Images

Get URL to the original image:

```php
$url = $image->url();
```

Get URL to image constrained to 128px (best fit, maintaining aspect ratio):

```php
$url = $image->url('128');
```

Get URL to image constrained to 128px in height (maintaining aspect ratio):

```php
$url = $image->url('128h');
```

Get URL to image constrained to 128px in width (maintaining aspect ratio):

```php
$url = $image->url('128w');
```

Get URL to image cropped to a 128px square:

```php
$url = $image->url('128s');
```

> **Note:** You may pass any arbitrary integer value for the image dimension.

{'fraction_non_alphanumeric': 0.13030987071619127, 'fraction_numerical': 0.010671044531089679, 'mean_word_length': 4.538636363636364, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2508983', 'n_tokens_mistral': 1556, 'n_tokens_neox': 1415, 'n_words': 606}