Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
minor fixes and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Fonseca committed May 20, 2015
1 parent 3439997 commit d10fe7d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
35 changes: 19 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Laravel image Manager package

A little Image Manager to use in forms and API's.

This is the stable version for Laravel 4.2.*, compatibility with laravel 5 is being scheduled.
This is the stable version for Laravel 5.x, if you want the 4.2 version check out the 1.0 branch

Requirements
============================
Expand All @@ -26,7 +26,7 @@ Installation
In your composer.json file add:

```js
"joselfonseca/image-manager" : "1.0.*"
"joselfonseca/image-manager" : "2.0.*"
```

Run `composer update`
Expand All @@ -35,19 +35,21 @@ Add the service provider

`'Joselfonseca\ImageManager\ImageManagerServiceProvider'`

Then run the migration
`php artisan migrate --package=joselfonseca/image-manager`
Then publish the package assets, config and migration.
`php artisan vendor:publish --provider=Joselfonseca\ImageManager\ImageManagerServiceProvider --force --tag=IMpublic`
`php artisan vendor:publish --provider=Joselfonseca\ImageManager\ImageManagerServiceProvider --force --tag=IMconfig`
`php artisan vendor:publish --provider=Joselfonseca\ImageManager\ImageManagerServiceProvider --force --tag=IMmigration`

Then public the assets.
Migrate the database

`php artisan asset:publish joselfonseca/image-manager`
`php artisan migrate`

Finally reference the assets in the layout

```html
<link href="{{asset('packages/joselfonseca/image-manager/css/imagemanager.css')}}" rel="stylesheet">
<link href="{{asset('packages/joselfonseca/image-manager/vendors/colorbox/colorbox.css')}}" rel="stylesheet">
<script src="{{asset('packages/joselfonseca/image-manager/js/imageManager.min.js')}}"></script>
<link href="{{asset('vendor/image-manager/css/imagemanager.css')}}" rel="stylesheet">
<link href="{{asset('vendor/image-manager/vendors/colorbox/colorbox.css')}}" rel="stylesheet">
<script src="{{asset('vendor/image-manager/js/imageManager.min.js')}}"></script>
```

Usage
Expand All @@ -56,8 +58,9 @@ Usage
Make sure you have a field in your database to store the image id and inside your form add

```php
<label for='titulo'>Imagen del Post</label>
<label for='titulo'>Image</label>
{{ImageManager::getField(['text' => 'Select the File', 'class' => 'btn btn-primary', 'field_name' => 'your_field_name', 'default' => '12'])}}
// the default parameter is the image id in your table for your resource.
```

Parameters
Expand All @@ -70,19 +73,19 @@ Parameters

How to render an image?

To render an image you can add to the src the route `action('showthumb', $id)`
To render an image you can add to the src the route `route('showthumb', $id)`

```php
// this will show a thumb
<img src="{{action('showthumb', $default)}}" />
<img src="{{route('showthumb', $default)}}" />
// this the full image
<img src="{{action('media', $default)}}" />
<img src="{{route('media', $default)}}" />
// this the full image resized by with
<img src="{{action('media', ['id' => $default, 'width' => 300])}}" />
<img src="{{route('media', ['id' => $default, 'width' => 300])}}" />
// this the full image resized by with and height
<img src="{{action('media', ['id' => $default, 'width' => 300, 'heigth' => 300])}}" />
<img src="{{route('media', ['id' => $default, 'width' => 300, 'heigth' => 300])}}" />
// this the full image resized by with and height in the canvas, not the image
<img src="{{action('media', ['id' => $default, 'width' => 300, 'heigth' => 300, 'canvas' => 'canvas'])}}" />
<img src="{{route('media', ['id' => $default, 'width' => 300, 'heigth' => 300, 'canvas' => 'canvas'])}}" />
```

API
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/AlocateFileException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*
* @author desarrollo
*/
class AlocateFileException {
class AlocateFileException extends \Exception{
//put your code here
}
2 changes: 1 addition & 1 deletion src/Exceptions/ModelNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
*
* @author desarrollo
*/
class ModelNotFoundException {
class ModelNotFoundException extends \Exception{
//put your code here
}
2 changes: 1 addition & 1 deletion src/ImageManagerServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private function publishesMigrations()
{
$this->publishes([
__DIR__ . '/migrations/' => base_path('database/migrations'),
]);
], 'IMmigration');
return $this;
}

Expand Down

0 comments on commit d10fe7d

Please sign in to comment.