I have my Laravel 8 project on a shared hosting which uses cPanel. Uploaded my files and database with some records, for old records website displays all the images, but when I upload new images they're not showing up, photos are uploading on a storage folder, but not showing up.
HTML code:
<img src="/storage/{{ $post->photo}}"/>
This is a link to a stored images:
https://website.com/storage/images/
PostController image upload:
$image = $request->file('photo')->store('images', 'public');
Any suggestions?
Found a solution from here:
laracasts.com
Solution is to delete the "STORAGE" folder if exists, then run this command line:
php artisan storage:link
Related
I have uploaded my laravel project in cPanel. Previous images are shown successfully but the newly added images are not showing.
Here last 2 images are already in the project before uploading in cPanel. After uploading the project successfully in cPanel I have try to upload an image but it is not shown which is first one.
Anybody help ?
I tryed with change in config/filesystem.php
Change the path from storage_path() to public_path().
but it not worked. please any help!
My storage folder exist in another structure /home/folder_name/public_html/storage
I don't know how I can access to this path
I have a website made with Laravel and recently i have uploaded it on cPanel and now i have some problems;
First problem is that in localhost i can save images in public/images from website and delete them but on cPanel no longer i could upload images.
Second issue is that i have removed all the images in cPanel but still my website loads that old images.When i go to image url directory there is nothing! i don't know how is it possible.
This is the code i used to save images:
$image = $request->file("image");
$new_name = "image" . "_" . $lesson->id . "." . $image->getClientOriginalExtension();
$image->move(public_path('images/lessons'), $new_name);
And the code for show images:
src="{{asset('images/lessons/image_'.$lesson->id.".png")}}"
This is my local folder :
Below you can find my public_html folder :
I have a website made with Laravel and recently i have uploaded it on
cPanel and now i have some problems; First problem is that in
localhost i can save images in public/images from website and delete
them but on cPanel no longer i could upload images.
Could you explain this a little bit more detailed? Thank you.
Second issue is that i have removed all the images in cPanel but still
my website loads that old images.When i go to image url directory
there is nothing! i don't know how is it possible.
Sounds like Cache. Have you tried to empty your browser cache after deleting the images on your server? If they are gone, it was the Cache. A cache will/can expire after some amount of time, so that should not be an issue.
If you want to disable caching while debugging you can turn it off in your developer console. See this answer: Disabling Chrome cache for website development
I hope this helps.
Try renaming the image, and after you rename, access the link for the renamed image ( using the new name ).
ie. www.xyz.com/image2.png
And then try delete.
I have code that relies upon a certain file naming convention. When I stopped working locally and made a new database and setup online and went to upload the images for the posts. Wordpress adds a -1 or -2 to my images even though it is a fresh db and fresh wordpress install.
The naming conventions I have are like so..
cover_somename.jpg
cover_somename_bg.jpg
Why would it make my files like cover_somename_bg-1.jpg when there are NO DUPLICATES in the media library. How can I turn this renaming feature off/ rename the files myself.
When you upload image on local it will create move image to upload folder. And while you moving project to live you create new data base you have only remove the image name from the data base table.
But you image still remain on Upload folder under the month folder that you have added
When you upload the same file name on live server on same month then it will check for "if file already exist or not if already exist then it will rename new uploaded file as you get.
you create new data base so you old image wouldn't display on admin so you need to clear the folder under the upload folder then it work fine please try once.
Ah images aren't in the DB turns out they are in uploads folder and if the uploads folder has images but its a fresh install the media library will be empty but will act like it has those files and renaming will occur.
I have created a simple upload form which resizes, encode to jpg (with help of intervention) and uploads the image to the directory public/profilepics/user['id']/profile.jpg.
Next I created a simple function delete to delete the picture from above mentioned directory.
The upload form also show the current profile.jpg in the respective folder. But when I have successfully deleted the picture(I confirmed by looking into the public/profilepics directory in file browser), I still see the old picture. After uploading another image, again I see the old image only.
Do laravel have remembering capability or have internal cache(I am not talking about the cache service include in laravel This one) which should be cleared to see the new image.
Actually I was working on updating profile picture page and encountered this problem.
Leave the comment if any of the file is needed.
I have had an issue with displaying uploaded images in my laravel application. The problem is, i had a directory in my public folder named uploads and this is where i stored uploaded images.
This displays images fine on my localhost but on my liveserver, the images don't display but when i saved the images this way public/images/uploads i.g. moving the uploads folder into the images folder the images display on the liveserver.
I have saved the image link in my database like so uploads/imagename.ext and i display it in the browser like so
<img class="img-responsive" src="images/{{($pgIndex->introTextImgLink)}}" style="width:100%; height:250px;"/>
The uploads folder has file permission 707. I really like to keep storing my uploaded images in the public/uploads folder but i am not sure what i could be doing wrong on my live server.