Images not displaying in Qtenv, showing question marks instead in Omnet++ - omnet++

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.

Related

Insert images into the project without them being in the Resource folder.(AppleScript App)

Is there any way to use images in the format .png or another format, and then compile these images so that they are not within the folder Resource of this project? I've seen several programs using many of the images as icons but when you open the folder resource the only image I see is the icon of the program.
If items such as standard system icons are used you only need their paths (since they would already be installed), otherwise the image files need to be included in the project.

How to load images (jpg) in QML generated at runtime

my question is quite simple.
I have a Qt application with a Gui developed with QML.
My back-end side generates and saves jpg images in a folder called /images .
I am able to send from C++ to QML the strings holding the name of the images that I want to show. Sadly my QML Image object doesn't display anything.
It seems that if an image can be displayed only if it has been previously declared in the qml.qrc file.
Sadly, again, qrc files do not support wildcards yet!
https://bugreports.qt.io/browse/QTBUG-1400
Is there a workaround?
The name of the images are not fixed, they are generated with certain runtime values i.e. timestamp.
Thank you
By default it will search the image source in the qrc file. To make it go to the actual file system, prepend a file:/// to the path.

JavaFX - Resource paths and loading an image

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!

Impossible to reference an image from the Assets Folder

I am currently building a Windows Universal App and the learning curve is OK. I get a response from my webservice, parse the JSON, display info in the app, but my current issue is the following one:
I tried to display an image that I put in the Assets folder, but this doesn't seem to work.
This is my layout:
As you can see, the text "Test" is correctly displayed but not the images.
On the right side, in the explorer pannel, I cannot see the files that should be here:
WHAT I HAVE TRIED:
In my example, they are in the Assets/picto folder, but I have also tried the root directory Assets, as wal as creating Image folder at the same level.
I have definitely no idea how to add a simple picture, so any help is appreciated!
Adding items in Windows explorer to the right location doesn't add them to your solution / deployment.
You have to right-click the picto folder -> Add > -> Add existing item. Your items are not even in your solution, so they won't show up on the layout screen.
Make sure you set the correct build target for each image.
If an image shouldn't show up, even through it's in your solution, this is often the reason.

How to download images from the same folder as where the image is uploaded?

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 :)

Resources