you should store your images in storage/app/public.
My guess is that they are just in the storage/app folder at present
guys iam working with a project online examination.
the question may contain images and the options may also contain images. and the explanation may be images or docs.
while taking a question if there is image for the question it must be stored in storage folder and to be retrieved.
i have a column ques_mage in my table.
and my blade file to upload is
<input name="ques_image" class="form-control" type="file" accept="image/*" onchange="document.getElementById('ques_image').src = window.URL.createObjectURL(this.files[0])">
<br>
<img id="ques_image" src="" class="rounded-circle" width="150" height="150" >
my controller
if ($request->hasfile('ques_image')) {
$ques_image = $request->file('ques_image');
$filename = $request->input('ques_no') . '-' .$ques_image->getClientOriginalName();
$path = $ques_image->storeAs('QuestionImages', $filename);
dump($path);
$addquestion->ques_image = $path;
}
here the image correctly stored in storage/app/QuestionImages folder. worked correctly.
and then i used php artisan storage:link this created a shortcut storage folder in my public folder.
now i need to display it in blade file.
i did like this
<img src="{{ asset('storage/app/'.$showques->ques_image) }}"> here i didnt mention the QuestionImages folder because the path stored in my table is with this folder name say for example QuestionImages/image.jpg like this
this is not working why???
and i have two doubts
i need to store pdf and document also. if i need to store the documents means what should i do the same process?? and how can i show it in the blade file??
why a storage shortcut created in public folder?
is this process correct?
and can i resize the image and store it in the storage folder?? because when displaying the question with options it looks so awkward to see. how can i make it unique
Kindly some help me pleasee.
If you have the file stored in storage/app/public/QuestionImages
then it will also appear to be in public/storage/QuestionImages
Please check this is the case.
Your file is stored once. The symlink makes one directory an alias of the other.
Your webserver can store the images in the storage/app/public folder, and then they appear to the outside world in the public/storage folder.
Please or to participate in this conversation.