Laravel 5 cloudinary upload file and images with example

Laravel 5 cloudinary upload file and images with example

Laravel 5 cloudinary upload file and images with example

In this tutorial, I will let you know how to upload files and images on cloudinary server.

Cloudinary provide best service for image and video manipulation on the fly. There is open source PHP library provided by Cloudinary.

There are lots of benefits to store your media files, images and videos on the Cloudinary that is cloud based service.

Main Features
  • Cloudinary deliver the responsive images.
  • Easily optimize the images.
  • Media files will be delivered through a fast CDN.
  • Easily integrate with the web and mobile application.

There is cool feature of cropping images on the fly.

In this example, we will upload the images on cloudinary using jrm2k6/cloudder package.

Install jrm2k6/cloudder

First, I will install jrm2k6/cloudder package using composer.

composer require jrm2k6/cloudder:0.4.*

Now add the following line with cloudinary information in your .env file.

CLOUDINARY_API_KEY=`your key`
CLOUDINARY_API_SECRET=`your secret`
CLOUDINARY_CLOUD_NAME=`your cloud name`

You will get the cloudinary information from Cloudinary.

Now open config/app.php file and add following service provider and aliases in respective array :

'providers' => array(
  'JD\Cloudder\CloudderServiceProvider'
);

'aliases' => array(
  'Cloudder' => 'JD\Cloudder\Facades\Cloudder'
);

Run following command to publish :

php artisan vendor:publish --provider="JD\Cloudder\CloudderServiceProvider"

After running above command, you will get cloudder configuration file in following path config/cloudder.php

There you can change the following settings :

CLOUDINARY_BASE_URL
CLOUDINARY_SECURE_URL
CLOUDINARY_API_BASE_URL
Add Routes

In this step, add following routes in your routes/web.php file.

Route::get('get-file', 'CloudderController@getFile');
Route::post('upload-file', ['as'=>'upload-file','uses'=>'CloudderController@uploadFile']);
Create CloudderController

Now create "CloudderController" in following path app/Http/Controllers to handle the request.

  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. class CloudderController extends Controller
  5. {
  6.     public function getFile(){        
  7.         return view('cloudder');
  8.     }
  9.     public function uploadFile(Request $request){
  10.          if($request->hasFile('image_file')){
  11. \Cloudder::upload($request->file('image_file'));
  12. $c=\Cloudder::getResult();
  13. if($c){
  14. return back()
  15.          ->with('success','You have successfully upload images.')
  16.          ->with('image',$c['url']);
  17. }
  18. }
  19.     }
  20. }
Create Blade File

Finally create a "cloudder.blade.php" file to render HTML form to upload files.

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Laravel 5 cloudinary upload file and images with example</title>
  5. <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  6. </head>
  7. <body>
  8. @if ($message = Session::get('success'))
  9. <div class="alert alert-success alert-block">
  10. <button type="button" class="close" data-dismiss="alert">×</button>
  11. <strong>{{ $message }}</strong>
  12. </div>
  13. <img src="{{ Session::get('image') }}">
  14. @endif
  15. {!! Form::open(array('route' => 'upload-file','files'=>true)) !!}
  16. <div class="row">
  17. <div class="col-md-6">
  18. {!! Form::file('image_file', array('class' => 'form-control')) !!}
  19. </div>
  20. <div class="col-md-6">
  21. <button type="submit" class="btn btn-success">Upload</button>
  22. </div>
  23. </div>
  24. {!! Form::close() !!}
  25. </body>
  26. </html>

$c=\Cloudder::getResult(); will return following output :

array:15 [▼
  "public_id" => "sample"
  "version" => 1499596361
  "width" => 864
  "height" => 576
  "format" => "jpg"
  "resource_type" => "image"
  "created_at" => "2017-07-09T10:32:41Z"
  "tags" => []
  "bytes" => 120253
  "type" => "upload"
  "etag" => "14500e08ec2701bfd36a8e9a5585261e"
  "url" => "http://res.cloudinary.com/demo/image/upload/v1499589454/sample.jpg"
  "secure_url" => "http://res.cloudinary.com/demo/image/upload/v1499589454/sample.jpg"
  "original_filename" => "sample"
]

You can save required details into your database. You can use public id to destroy images in following way :

Cloudder::destroyImage($publicId, array $options)
Cloudder::delete($publicId, array $options)

Phone: (+91) 8800417876
Noida, 201301
okey metin2 pvp serverler metin2 pvp
ataşehir escort maltepe escort bostancı escort kadıköy escort maltepe escort ataşehir escort tuzla escort pendik escort ümraniye escort kartal escort
pendik escort
izmir escort izmir escort izmir escort izmir escort denizli escort antalya escort antalya escort antalya escort izmir escort izmir escort izmir escort izmir escort izmir escort
antalya escort akseki escort aksu escort alanya escort bayan antalya escort antalya grup escort antalya masöz antalya rus escort antalya sınırsız escort antalya travesti escort bdsm escort beldibi escort bayan belek escort bayan çallı escort bayan çamyuva escort bayan demre escort bayan elmalı escort bayan fethiye escort bayan finike escort bayan göynük escort bayan güllük escort bayan ışıklar escort bayan kaş escort bayan kemer escort bayan konyaaltı altınkum escort bayan konyaaltı arapsuyu escort bayan konyaaltı escort bayan konyaaltı liman escort korkuteli escort bayan kültür escort kundu escort bayan lara escort bayan manavgat escort bayan muratpaşa escort bayan örnekköy escort bayan rus escort bayan serik escort bayan side escort bayan suriyeli escort tekirova escort bayan üniversiteli escort alanya escort mahmutlar escort alanya escort mahmutlar escort alanya escort mahmutlar escort istanbul escort avrupa yakası escort şişli escort topkapı escort istanbul vip escort maslak escort merter escort aksaray escort arnavutköy escort ataköy escort bağcılar escort bahçelievler escort bakırköy escort beşitaş escort beylikdüzü escort beyoğlu escort halkalı escort istanbul sınırsız escort kağıthane escort mecidiyeköy escort nişantaşı escort escort istanbul ataşehir escort beykoz escort çekmeköy escort kadıköy escort maltepe escort pendik escort sancaktepe escort şile escort sultanbeyli escort tuzla escort ümraniye escort üsküdar escort
beylikdüzü escort istanbul escort şişli escort beylikdüzü escort istanbul escort
kocaeli escort izmit escort bayan gebze escort izmit sınırsız escort escort bursa tuzla escort aydınlı escort orhanlı escort bursa escort escort bayan istanbul escort istanbul sınırsız escort istanbul bayan escort izmit escort izmit escort kocaeli escort sisli escort mecidiyekoy escort bursa escort bayan bursa görükle escort maltepe escort goztepe escort yakacik-yeni-escort bursa sınırsız escort sisli escort bayan taksim escort bursa escort porno izle sikiş izle atasehir escort antalya escort
ankara escort marmaris escort bursa escort mersin escort antalya escort izmir escort samsun escort bodrum escort çeşme escort kuşadası escort adana escort eskişehir escort gaziantep escort esenyurt escort pendik escort tuzla escort fatih escort ümraniye escort mecidiyeköy escort kartal escort bahçelievler escort bahçeşehir escort ataşehir escort bakırköy escort nişantaşı escort avcılar escort büyükçekmece escort kurtkoy escort konya escort beşiktaş escort taksim escort beylikdüzü escort malatya escort sakarya escort şişli escort maltepe escort kadıköy escort ataköy escort bostancı escort şirinevler escort bağcılar escort üsküdar escort etiler escort başaksehir escort ortaköy escort kağıthane escort sultangazi escort halkalı escort çekmeköy escort şaşkınbakkal escort mamak escort sincan escort keçiören escort çankaya escort beypazarı escort akyurt escort pursaklar escort kahramankazan escort göztepe escort alsancak escort bornova escort buca escort karabaglar escort karşıyaka escort konak escort narlıdere escort izmit escort başiskele escort kandira escort körfez escort karamürsel escort dilovası escort gölcük escort gebze escort kocaeli escort kayseri escort elazığ escort denizli escort diyarbakir escort adana escort ankara escort izmir escort antalya escort gaziantep escort kayseri escort konya escort mersin escort denizli escort kocaeli escort diyarbakır escort alanya escort manavgat escort bursa escort eskişehir escort sakarya escort samsun escort malatya escort trabzon escort adıyaman escort afyon escort ağrı escort aksaray escort amasya escort ardahan escort artvin escort aydın escort balikesir escort bartın escort batman escort bayburt escort bilecik escort bingöl escort bitlis escort bolu escort burdur escort çanakkale escort çankırı escort çorum escort düzce escort edirne escort elazığ escort erzincan escort erzurum escort giresun escort gümüşhane escort hatay escort ığdır escort ısparta escort maraş escort karabük escort karaman escort kars escort kastamonu escort kilis escort kırıkkale escort kırklareli escort kırşehir escort kütahya escort manisa escort mardin escort muğla escort muş escort nevşehir escort niğde escort ordu escort osmaniye escort rize escort urfa escort siirt escort sinop escort şırnak escort sivas escort ordu escort tokat escort tunceli escort usak escort van escort yalova escort yozgat escort zonguldak escort kıbrıs escort
adana escort ankara escort bursa escort diyarbakir escort eskisehir escort kayseri escort kocaeli escort konya escort malatya escort maras escort mersin escort ordu escort sakarya escort samsun escort hatay escort mardin escort tekirdag escort antalya escort aydin escort nigde escort nevsehir escort elazig escort manisa escort osmaniye escort denizli escort mugla escort
bedava bahis
tahmin
ankara escort - ankara escort
ataşehir escort ataşehir anadolu yakası escort ankara escort antalya escort antalya escort

flynta 5 mg

flynta 5 mg fiyat

orcafil 5 mg

lifta

degra

sildegra

combo 100 mg

degra 100 mg

vigrande

sinegra

jeligra

lifta 20

vigrande 100 mg

lifta 20 mg

lifta 5 mg

sildegra 100 mg

vigaroo

flynta 20 mg

viagra 100 mg fiyat

orijinal viagra

viagra 100 mg

eczane viagra

viagra sipariş

viagra satın al

viagra nedir

viagra yorum

viagra fiyat

viagra fiyatı 2021

cialis

cialis fiyat

cialis 20 mg

cialis 100 mg

cialis nedir

cialis 5 mg fiyatı

cialis hap

cialis 5 mg

cialis 20 mg eczane fiyatı

cialis 100 mg fiyat

cialis satış

izmir escort
ataşehir escort
pendik aktar