0

I'm trying to upload images. The uploading working perfectly, but when I'm trying to upload a jpg image it will automatically convert to jpeg. This is my code

if($request->hasFile('image'))
        {
            if($request->file('image')->store('public/gallery'))
            {
                $gallery = new Gallery();
                $gallery->album_id = $request->album;
                $gallery->photo = $request->image->hashName();
                $gallery->save();
                Session::flash('message','Success:: Image added to gallery');
                Session::flash('alert','alert alert-success alert-dismissable');
                return back();
            }
            else
            {
                Session::flash('message','Warning:: Failed to upload the image');
                Session::flash('alert','alert alert-warning alert-dismissable');
                return back()->withInput();
            }
        }

I'm really looking for some help, Thank you

Manu Joseph
  • 389
  • 4
  • 10

1 Answers1

1

Laravel automatically determine file's extension by examining their MIME type. Really there are no difference between jpg and jpeg. See JPG vs. JPEG image formats

Artyom Blagoda
  • 368
  • 3
  • 10
  • If I need the same image and format, is that possible?. I am looking for a solution without custom naming. I am looking for a laravel technique – Manu Joseph Oct 29 '18 at 18:51