/**
  * Update the specified resource in storage.
  *
  * @param  int $id
  * @return Response
  */
 public function update(PhotoRequest $request, Photo $photo)
 {
     $photo->user_id_edited = Auth::id();
     $picture = $photo->filename;
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $picture = sha1($filename . time()) . '.' . $extension;
     }
     $photo->filename = $picture;
     $photo->update($request->except('image'));
     if ($request->hasFile('image')) {
         $photoalbum = PhotoAlbum::find($request->photo_album_id);
         $destinationPath = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/';
         $request->file('image')->move($destinationPath, $picture);
     }
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function postEdit(PhotoRequest $request, $id)
 {
     $photo = Photo::find($id);
     $photo->user_id = Auth::id();
     $photo->language_id = $request->language_id;
     $photo->name = $request->name;
     $photo->photo_album_id = $request->photo_album_id;
     $photo->description = $request->description;
     $photo->slider = $request->slider;
     $photo->album_cover = $request->album_cover;
     $picture = $photo->filename;
     if ($request->hasFile('image')) {
         $file = $request->file('image');
         $filename = $file->getClientOriginalName();
         $extension = $file->getClientOriginalExtension();
         $picture = sha1($filename . time()) . '.' . $extension;
     }
     $photo->filename = $picture;
     $photo->save();
     if ($request->hasFile('image')) {
         $photoalbum = PhotoAlbum::find($request->photo_album_id);
         $destinationPath = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/';
         $request->file('image')->move($destinationPath, $picture);
         $path2 = public_path() . '/appfiles/photoalbum/' . $photoalbum->folder_id . '/thumbs/';
         Thumbnail::generate_image_thumbnail($destinationPath . $picture, $path2 . $picture);
     }
 }