Ejemplo n.º 1
0
 public function show($hash, $time, $small = false)
 {
     $image = Image::where('hash', '=', $hash)->where('uploaded_at', '=', Carbon::createFromTimestamp($time))->first();
     if (null === $image) {
         throw new NotFoundHttpException();
     }
     return $this->imageResponse(image_path($hash, $time, $small), $image->getAttribute('mime_type'));
 }
Ejemplo n.º 2
0
 /**
  * Delete the profile picture.
  *
  * @param $id
  */
 protected function deleteOldProfilePicture($id)
 {
     $image = Image::find($id);
     if (null !== $image) {
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp));
         unlink(image_path($image->getAttribute('hash'), $image->getAttribute('uploaded_at')->timestamp, true));
         $image->delete();
     }
 }
Ejemplo n.º 3
0
 /**
  * Create image record.
  *
  * @return Image
  */
 protected function createDatabaseRecord()
 {
     return Image::create(['hash' => $this->hash, 'mime_type' => $this->image->mime(), 'uploaded_at' => $this->uploaded_at->timestamp]);
 }