I have an assets folder containing images outside of the root directory. I want the image to be displayed if i using two different paths: for example
www.example.com/assets/aa.jpg
www.example.com/assets/test/aa.jpg
Please help me to resolve this.
Related
I've deployed my website using Heroku. I am also using Vueper Slides which needs a variable, which is an array, containing the path to the image. On the live website I noticed that it does not contain the images folder contained in my dist folder. What can I do to fix this?
Javascript array variable:
dist directory:
Heroku source files:
This is not a definite answer, but can help.
I noticed you are using the public folder where you keep your images.
you may want to double check that the path is correct because it should just load stuff within the public folder.
However, I don't understand why it doesn't load in the images folder from dist.
Qtnev environment
I have used the "i=device/f1" tag to refer to the images in my .ned file. But when i run it, i get is the question marks in the Qtenv environment not the images that i wish to display. I have tried setting the exact path on the .ned file "i=omnetpp-5.6.2/images/device/f1". Still has not worked, how would i resolve this?
i tag in .ned file
You get question marks because Omnet++ they do not find your image in this path. In your installation directory, Omnet++ has a folder with images. In this folder, you can create your folder with your custom images or icons. For example, you can download something like this and add it to your custom folder.
In my images, I have created a folder with the name cars, I add the above image and rename it to f1.png.
In my ned file, I add the folder and the name of the image
Server: StandardHost {
#display("p=303,254;i=cars/f1");
}
Keep in mind that maybe you want to resize your photo before you add it to your folder to fit better on your screen.
My image doesn't want to be loaded, I don't know if it's the path, image format or error in the code. I have tried to detect what the problem is by different ways.
Here is the error code.
My workspace is located at
This folder contains two additional folders, "bin" and "src". I have tried relocating my image to different subfolders just to be sure.
But still won't work, unfortunately. After having read the questions here on the site, there was a suggestion to check the path with these two short codes.
(tried also with texAccount.png)
The first command was successful, giving me the following line.
And then I became confused. It wants to load files from the "bin" subfolder, however my Scanner opens, reads, writes all the files into the root folder. I do not have my text files in the "bin" subfolder but the root folder and works perfectly. Maybe it just loads from the very first folder in my root folder? I created a subfolder named "asd" just to check it: No, I was wrong. The program definitely wants to load my image from the "bin" folder, giving me the same message as above.
I spammed all the folders with my picture. Okay, so my image is in the right folder after all. I thought I would check my code rather.
I tried to change the "texAccount.png" in code to just "texAccount", still would not load. Then I renamed my actual image file to "texAccount" and "texAccount.png", however I combined the names it showed no progress.
My image is only 20x20 in size, but contains alpha channel. As I am a beginner, I do not know, maybe alpha images must be dealt in some other ways, so to be sure I deleted my alpha channels and made a fully black picture, basically a 20x20 black box, no success.
I have tried converting my file to .jpg and three other formats.
I have imported all the required classes and packs needed for working with images.
Thank you very much!
( I posted all my codes and quotes as pictures )
Image image = new Image("texAccount.png");
Do not need to do other steps!
I want to display all images belong to a folder on front end using file module. I am new to pyro and I am only able to figure out how to display only one image.
`{{ base_url }}/large/image_name.jpg`
I will have one main images folder then may sub folders which will be having images. How to get all images belong to a folder in a loop?
You will need to iterate through the folders to create the image tags that you want.
Take a look at Files Plugin in the PyroCMS docs. The sample code has been provided there. You can handle conditions using tags as shown in PyroCMS Tags
I am creating a project wherein the user can upload his photo. This photo is stored in the folder "images/uploads/filename". When his profile is created and the photo is to be shown, I use the <img> tag with src as "images/uploads/filename", but the photo does not show up.
If I manually copy the photo to an adjacent folder "images/abc/filename" and then use it as the source then it works.
How is this caused and how can I solve it? I need to use the same folder to upload and download photos.
That can happen if you're running the webapp as an IDE project and are storing the uploaded images in the IDE's project space. Changes in the IDE's project folder which are performed externally (as by your servlet code) does not immediately get reflected in the deployed server's work folder. Only when you touch it (by refreshing the project) or by copying it (as you happen to have found out), then it will get reflected.
After all, storing uploaded files in the webapp's deploy folder is a bad idea. Those files will get all lost whenever you redeploy the webapp, simply because those files are not contained in the original WAR file.
You need to store them somewhere outside the webapp's deploy folder on a different fixed path like /var/webapp/uploads. You should not use relative paths or getRealPath() to create the File object around it. Just use a fixed path. You can always make the fixed path configureable as a context param setting, a VM argument, a properties file setting or even a JNDI entry.
Then, to serve it to the world wide web, just add exactly that path as another docroot to the server config. It's unclear what server you're using, but in Tomcat it's a matter of adding another <Context> to the server.xml.
See also:
Uploaded image only available after refreshing the page
How I save and retrieve an image on my server in a java webapp
Make sure your have the correct path and include the image extension
just for testing, put your img tag inside the index.php
<img src="images/abc/filename.jpg">
/root/index.php
now put you image in to the your abc/ folder
/root/images/abc/filename.jpg
This should display the image.
if you have your img tag inside another folder in the root like below
/root/user/index.php
now when you use you img tag use this path (relative link):
<img src="../images/abc/filename.jpg">
note the beginning of the image path "../" this is used to go back to the root.
if the php or html file that is holding the img tag is even deeper, just remember to add ../ for every level, 2 folders deep whould be:
<img src="../../images/abc/filename.jpg">
Question was quite vague so hope this is what you are looking for.
let me know and if this is wrong, explain a little more and i will try to help :)