JavaFX - Resource paths and loading an image - 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!

Related

Images not displaying in Qtenv, showing question marks instead in 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.

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.

Images not displaying in word File after linking images in the file

I have a word file.
I have inserted images by linking it to avoid more size of doc file. Here I have kept the all images into a folder and linked in the doc file. This works fine.
But, when I send to my friend the doc file the the image file, the images cannot be seen. Quite obvious due to path has been changed.
I don't want to host the images online. If I do, this will resolve if I'm online.
If I'm off line I can't view the images in the doc file.
How do I overcome this problem?
Why not just get your friend to edit hyperlinks to update it to location of each image on their machine?

Image path in Magento keeps going to base folder

I'm trying to add an image on my CMS page by using something like {{skin url=images/foldername/image%2011.jpg}}
With this, I should get a path like 123abc/magento/skin/frontend/default/default/images/foldername/image%2011.jpg
But instead of that path, I get a path going to the base like so
123abc/magento/skin/frontend/base/default/images/foldername/image%2011.jpg
I'm 100% sure that the folder works because I have other images on the same folder that works in other pages. I didn't change the package name so I'm not sure why this is happening for some files. Based on what I found on the web, magento looks for the image at the base folder if it can't find the file on the specified path but the image is there. Does anybody know how to resolve this and what else could be causing this?
Solution by OP.
I noticed how I got this problem only with images with spaces on the filename hence the %20 on the file path. Though I was given literally hundreds of images with spaces on their filenames, the easiest and fastest way to resolve this is to remove the space for each of the image.

Cannot delete particular file

I am developing gallery viewer app. App will fetch the image file from Isolated Storage and will show in an image control. Most of the things are already setup and working fine.
Now images are stored in folders which act as album and user can delete the whole album. I tested with many many folders with assorted images and delete works fine. But I see that when there is a particular image file of name "XXXX.jpg", it doesn't get deleted. Although all the images from folder are shown in image control. That file doesn't gets deleted, and an exception is thrown "ArgumentUnhandledException". I tried after renaming the file but earth didn't move.
Also, for testing purposes I am transferring folders(with images in it) using "Windows Phone Device Manager". I know it is not official to use it, but it makes testing easy. Also peculiar thing is that "Windows Phone Device Manager" also cannot delete that particular file, although I dumped that file in app's isolated storage using "Windows Phone Device Manager". So I think that there is some problem with that file.
How can I delete the file. And if I cannot, how can I know it before hand that some files cannot be dealt with properly and should not be dumped in Isolated storage.Here is that file. File is inside zip file. I think file is required and not not just uploading image to a image hosting site. Please take a look. Also try not to look over the content of image file, that's only random file which is not working and I want to know why.
I found that file was marked read-only and was causing problem when a delete attempt was made. Removing read-only solves the problem.

Resources