I'm working in the Laravel web-app. My images are stored in "public/assets/dist/img"
What I'm using in my view is :
<img src="{{asset('dist/img/user1-128x128.jpg')}}" alt="User Avatar" class="img-size-50 mr-3 img-circle">
but when I try to execute my Laravel app using "php artisan serve" I see my images are broken, when I try to inspect and get image src that is: http://127.0.0.1:8000/dist/img/user1-128x128.jpg
It shows 404 | Not Found page.
I double checked that image with name "user1-128x128.jpg" exists in "public/assets/dist/img"
Why I'm not able to see the image?
Is there something I'm missing?
It would be :
{{ asset('/assets/dist/img/user1-128x128.jpg') }}
assuming that your /assets/dist/img/user1-128x128.jpg is under /public/
Related
where I link index.js
<script src="/assets/js/index.js"></script>
Folder Directory is such
assests
-css
--style.css
-js
--index.js
enter image description here
Error Im getting
index.html:25 GET file:///assets/js/index.js net::ERR_FILE_NOT_FOUND
I guess you are using an express app(by the tag in question). The static resources such as your javascript, css, images, etc. should be inside the public folder which gets served on running the application. Could you try moving the assets folder inside the public folder and then have a script tag pointing to that resource.
Maybe it helps to remove the first slash:
<script src="assets/js/index.js"></script>
Or startend with a dot
<script src="./assets/js/index.js"></script>
I have created a symfony project.
For manage the js and the css I use webpack encore as advised in symfony official.
And in dev environment, everyhting works well.
yarn run encore dev create correct path for my asset.
An example of my html
link href="{{ asset('build/page-connexion/connexion.css') }}"
the request URL for that is
http://localhost:8000/build/footer/footer.css
But in production when I run "yarn run encore production"
the path is not correct
the request url for the footer is
http://mydomain.fr/build/footer/footer.css
it should be http://mydomain.fr/mywebsite/public/build/footer/footer.css
How and where can I configure this path? in my HTACCESS?
I know that if I change setPublicPath('myfullpath') with the path of my server in the webpack.config.js it will works. But logically i don't have to change it?
Thanks in advance for your help
public is root directory for your webserver. And if you configured setOutputPath and setPublicPath in webpack.config.js you need just add link href="{{ asset('your_entry_point.css') }}" to html code. Also you can check entrypoints.json this file will contain all paths for your entrypoints.
I need to display related image in ngFor
Like
<div class="row" *ngFor="let name of cheaterNames">
<div class="col-4">
{{ name.name }}
<img src="{{name.path}}" class="rounded mx-auto d-block">
</div>
</div>
This is how the data look like in database
_id OgjectId("566666tyyhhhh")
name Laravel
path uploads\logo.png
This how my project folder looks like
Project
client
about
about.component.html // this the html i used to display images
about.component.ts
dist
e2e
node_modules
server //this is where express/nodejs
controllers
models
routes
app.ts
uploads // this is where the images is stored during file uploads
logo.png
other imgs...
Any ideas for this? The image does not show up and shows 404 error
Your paths will all be relative to the base content directory for your web server which is probably not your project's home directory. Basically, the uploads directory is not within your base content directory, so your image files will not be found by the server at runtime. You need to determine where your base content directory is (express server configuration) and ensure that your uploads directory is under that directory.
For example, if you're serving up a build from the dist directory, uploads should be under dist;
I'm very new to Polymer. i read this official polymer documentation and downloaded a code sample and ran it using polyserve without modifying the code.I followed instructions given in polymer-project website. I installed every required components but after running polyserve command, it shows a page with 'Not found' text. Please help me.
I've installed npm 3.3.6,node v5.0.0.,gulp 3.9.0 and bower 1.7.7. All the commands are running fine without any error. I can't understand what exactly is going wrong.Am i missing something?
Polyserve output
Start server and try: http://localhost:8080/components/icon-toggle/demo/
Your folder structure should look like this:
[folder-path]/polymer-first-elements
README.md
bower.json
bower_components
demo -> contents: icon-toggle-demo.html & index.html
icon-toggle-finished
icon-toggle.html
Make sure the default port used by polyserve (3000) is not busy,you can use polyserve -p 8000 to try other port
You don't say what URL you are trying to access in the browser, but the sample code doesn't have any index.html file at its root, so accessing it there will fail.
There is an index.html in the demo directory, so you might have to add that to the url to access it.
I found I needed to add the following line to the <head> element of /demo/index.html:
<link rel="import" href="/bower_components/polymer/polymer.html">
Then view http://localhost:8080/demo (note the trailing "demo").
I have deployed an app at heroku.
Everything works fine, locally. However, when deployed heroku can't find two img. index.html contains exactly this, at different places :
FOUND <img src="img/bamboo-black.png" height="27"> <div class="loaderWrap">
NOT FOUND <img class="loader" src="img/ajax-loader-black.gif"></div>
NOT FOUND <img src="img/person-placeholder.jpg" class="mainPicture" width="150">
Why would it work locally and fail on heroku ? I don't understand.
Did you commit those two files to the repo?
Do a git status and see if they're in the 'new files' section.
If you've committed the files, then login to the Heroku dyno and verify they are there.
$ heroku run bash
You can also try a restart.
$ heroku restart
Fixed it.
For those who might encounter the same problem someday : i used a CDN (cloudinary)
I replaced :
<div class="loaderWrap"> <img class="loader" src="img/ajax-loader-black.gif"></div>
By this :
var $loader = $.cloudinary.image( LJ.cloudinary.loader_id, LJ.cloudinary.displayParamsLoader );
$loader.appendTo( $('.loaderWrap') );
It works fine now.