0
Good
i have a form that uploads images , these images are played in the directory: uploads/{idcampaign}/images/
In my PHP controller how do I access this image and grab your content?
public function get($id) {
/** @var UploadedFile $file */
$image = $this->repository->byId($id)->first();
$url = "/storage/app/" + $image->path;
if($image) {
return response()->file($url , ['Content-Type' => 'image.png |
image.jpeg']);
}
throw new NotFoundHttpException('image-not-found');
}
I tried that and it didn’t work. I just need to get to the image and get its contents so I can return to the view.
What do you mean "content"? The image content is binary, you won’t be able to represent it directly in json. Why don’t you walk her way to the view?
– bfavaretto
I try to pass a <img src="route"> but this route is not publicly accessible, so I’m trying to get the "content" of the image through a controller
– Gabriel.H