-
-
Save ninjamonk/99c2eec5e399fc960041 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Resizer and Image Manipulation | |
| // Based on: http://forums.laravel.com/viewtopic.php?id=2648 | |
| public function post_edit_logo($id) | |
| { | |
| $rules = array( | |
| 'image' => 'image', | |
| ); | |
| $validation = Validator::make(Input::file('logo'), $rules); | |
| // create random filename | |
| $filename = Str::random(20) .'.'. File::extension(Input::file('logo.name')); | |
| // Save logo in the database | |
| $event = Events::where('user_id', '=', $id)->first(); | |
| $event->logo = $filename; | |
| $event->save(); | |
| // start bundle 'resizer' | |
| Bundle::start('resizer'); | |
| // resize image | |
| $img = Input::file('logo'); | |
| $success = Resizer::open($img) | |
| ->resize(60 , 30 , 'auto' ) | |
| ->save('public/uploads/thumbnails/'.$filename , 90 ); | |
| // move uploaded file to public/uploads | |
| Input::upload('logo', 'public/uploads', $filename); | |
| } | |
| So I first resized the image and then uploaded it. | |
| And the second part was that the save method accepts an file path rather than a directory path. Didn't look close enough at the documentation... | |
| Thanks everybody for your help. | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment