I have uploaded my Laravel app to CPanel and it works completely fine. Then, I was making some changes to the Views by adding some new blade files. I also add new images to the public folder, where I put my previous images and it was working completely fine. But when I load the new page, the images are not showing, only the older image that I have uploaded before.
The HTML tag is the same as the already existing image but why it is not showing?
This is the HTML tag that I use in the blade:
<img src="{{ url('images/logo-cimahi.svg') }}"/>
I put the images in the public/images/ for the already existing images but the new images in the same path not showing.
Does my image broken or do I have to do something with PHP artisan command?
Try to clear all Laravel's cache, just run the following command:
$ php artisan optimize:clear
This will be an ouput:
Compiled views cleared!
Application cache cleared!
Route cache cleared!
Configuration cache cleared!
Compiled services and packages files removed!
Caches cleared successfully!
Related
For some reason, the pictures aren't loading at all anymore on the blade view, I tried display a picture I pasted on the storage folder manually not dynamically but it didn't show either so I'm pretty sure the problem is that the server can't access the content of the storage file?
I am storing the pictures in the database using the following code:
if($request->hasFile('logo')){
$formFields['logo'] = $request->file('logo')->store('logos','public');
}
then accessing it in the blade view using
<img
class="w-48 mr-6 md:block"
src="{{$album->logo? asset('storage/'.$album->logo) : asset('/images/noalbum.png')}}"
alt=""
/>
I made sure the pictures are properly stored in the database and in the storage file:
I tried some solutions I found online, as running php artisan storage:link or manually deleting the folder then creating it again, or replacing asset('storage/'.$album->logo) with Storage::url($album->logo) but none of that seemed to work. What's weird is that this same code snippets used to work just 2-3 days ago just fine. I'm assumed it was because I'm using livewire or constantly pushing commits of this project in git, but it didn't seem to make much sense in my head.
The Github repository file if needed to access any other files:
github link
in my Laravel 5.6 project i have a image URL
<img alt="بيتي فور" src="http://localhost/alhazim_working/public/assets/images/spinner.gif" data-src="http://localhost/alhazim_working/public/uploads/products/images/thumbnails/Petit four_2_3.png">
After run the composer update the url is not comes with public and image is not loading
<img alt="بيتي فور" src="http://localhost/alhazim_working/assets/images/spinner.gif" data-src="http://localhost/alhazim_working/uploads/products/images/thumbnails/Petit four_2_3.png">
similarly all the Css, Js and other images not working without public in url
also i run composer dump-autoload and php artisan cache:clear and generate key after composer update
and my folder structure is
also i run project without artisan commant
Laravel has a public folder which is the base folder for all requests. So if an image is in there you don't need to enter public in the url.
If your assets folder is in the public folder of laravel your url has to be like this:
http://localhost/assets/images/spinner.gif
instead of:
http://localhost/alhazim_working/public/assets/images/spinner.gif
Change it and your images will be displayed.
I have a site under Laravel based on a template uploaded on Themeforest. I use the CSS proposed by this template. I would like to set up custom CSS rules but I have the impression that Laravel has a cache. No CSS changes are displayed. I have the problem in two cases: if I make a new CSS file or even if I modify an existing CSS file.
I tried to clear my browser's cache.
I tried to clear Laravel's cache with artisan views:clear and artisan cache:clear.
I also checked that my CSS files were included in my Blade file.
This is strange because if I put CSS directives directly into my Blade file as HTML (style=""") it works. But once it's in an external file it doesn't work.
Do you have any leads ?
Please try this code for the bootstrap cache clear.
php artisan cache:clear
php artisan config:cache
or
php artisan optomize
I have set Laravel dropzone and it's working on my project.
I have cloned that project and trying to modify things but when I'm trying to upload files it's working and they are in the storage but when I want to see my files that I have uploaded I get
404
Sorry, the page you are looking for could not be found. error
This is my link when I click on the document
I'm using Laragon
EDIT:
I noticed that I have public >storage>storage
path:
public\storage\storage
And also a file named storage where I have a public file with an app file where inside I have another storage file
something like
path:
storage\app\public\storage\
Your link is looks like incorrect, http://mylocal.test/storage/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf the storage path repeated on the url.
Can you try single storage path in the url?
http://mylocal.test/storage/eOSuhkeabtKGuj4PRGePv0dxl8Fl0iQ3n7qLKvHs.pdf
SOLUTION: when you clone your project delete public>storage and run
php artisan storage:link
to link it with your new path
I have cloned a Symfony2 project on my local machine.
I got it up and running but assets in my web/Resources folder won't load (be it images or json files).
I have noticed that after running assetic:dump the css and js files are placed into the web folder and can be accessed from my app at:
localhost:8000/localFolder/web/app_dev.php/css/725c7d7_inuit.min_1.css?version=4.22
I have tried to place my images in the web folder and in the web/Resources/public/images folder as suggested in the Symfony good practices. However when I try to access my image with this link:
http://localhost:8000/localFolder/web/Resources/public/images/phone-service/on-the-clock.jpg
it doesn't work.
Any idea ?
You should add your images file (same for css file and javascript file) in
Resources/public/images( same for css : Resources/public/css, js files: Resources/public/js) under your bundle.
Like this:
AppBundle/Resources/public/images
And run this command to generate resources in your web folder
php app/console assets:install
Note that you should run this command line after every modification in your public folder.
if you don't want to make this every time and attribute --symlink
php app/console assets:install --symlink