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

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.

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.

Original filetype of ashx file

I'm building a PHP application that uses data from a web service. I add an image to a desktop application which then saves it to the web. The web service provides image URLs using the .ashx file extension. If I put one of these in an <img src="file.ashx?pictureId=abc123">, it displays as an image.
I want to store these images. I know they'll generally be .jpg files and can run file_get_contents on this and save it as such. However, if one was a .png, for example, I'd still be saving it with a .jpg extension, so it's an assumption I don't wish to make.
I've had a look at the raw string of characters of the file and cannot see any identifying features to tell me that it's a .jpg, apart from perhaps the clue that it was created in Photoshop. Nowhere does it say what kind of file it was originally, either extension or original filename.
Is there a way of finding the original filetype of a file contained within .ashx URL?
The question doesn't make any sense. Maybe the .ashx script generates the image on the fly out of nothing and there is no "original".
The correct question is: how to find the type of the image retrieved from the .ashx URL?
Save the image into a (temporary) file then use getimagesize() to find its type (GIF, JPEG, PNG etc) and choose the correct termination for its final file name.

Extract images from .swf viewer?

I'm wondering how it possible to extract images from .swf viewer?
Note that .swf file have not images itself.
For example I'm trying extract images from AVON catalogue from this link - http://avon.com.ua/PRSuite/eBrochure.page?index=1&cmpgnYrNr=201404&pageNo=0
Any ideas?
Best way is to put the .swf file in a decompiler for image extraction. Decompilers are smart enough to extract images for you and arrange them.
JPEXS Free Flash Decompiler is a more popular one
http://www.free-decompiler.com/flash/
You can extract other useful content from it as well.
Just download the .swf file from the website
A while back (like around 1999) I wrote a set of tools for Flash animations.
One of the tools is swf_dump which can be used to extract objects (i.e. write the objects in a form of script that sswf can nearly recompile...)
The tool also allows for extracting images that are inline (not downloaded dynamically by the flash animation, if so, anyway, you could as well download those images manually, you'd need the URL, though.)
The command line you can use is:
swf_dump -d my-animation.swf
Then your current folder will be littered with all the images that were found in the flash file. It extracts JPEGs and PNGs. The source can be compressed (SWF or CWF are supported.)
Now, you're on your own to compile that thing... The project is here and is in great need of updating (but Flash is kind of going out too...)
https://sourceforge.net/projects/sswf/

Delphi - Want an automated way of maintaining the link between a "source" image file and images in my project

One thing I find Delphi doesn't manage well is the link between image "source" files and the image components in my project (D2006 here but I'm assuming it applies to all versions).
Say I have various static images in my project - backgrounds, toolbar button glyphs, various bits of eye candy, etc. I have a corresponding collection of PNG/BMP etc. files that I have sourced, scraped or created, and these have been loaded into the image components at design time.
One problem is that there seems to be no automated way of finding out three months later what source image file was used to load an image component. This becomes more of an issue when you need to edit one or more images.
So what I would really like, is some way of including the image source files in a build of a project. I.e. when I did a build, all of the image components would be reloaded from the sources first. At present, when I modify some of my images with PhotoShop or similar, I'm faced with a lengthy and error-prone process to reload the altered images into their respective image containers.
Is creating a resource with all of the images bound into it and adding code to load the image components at startup a viable way to go? Do others have this problem, and how do you manage it?
None of the standard components support what you are asking for. However, Thany's TPngImageList component does support the ability to associate a user-defined string with each image in the list.
Otherwise, to know which file belongs with which image, I would suggest using an .rc file to compile the external image files into the app's resources at compile-time, and then you can load the image resources into your components dynamically at run-time instead of at design-time. That way, you can manage the image files however you want. When you change a file, it will automatically be linked into the app on the next compile.
You might load the same images in runtime, and add these images in version control to ease maintenance. There are also command line tools for Lazarus (I guess you might find similar for Delphi too) which can put files into resources that you app can later use.
I load the images from ico files, populate a imagelist and then use it in my Virtual string tree for various nodes. Easy to change the ico files.
/Mikael

Image of the object within .STL File

Please take a look on the website http://quotes.rapidprototype.com.au/upload/ and upload STL File and press "Start Upload" button. You shall see the image of the object within the stl file as (.png) image. I want the same functionality(The image of the of the object within the stl file, rest of the work i can do). I want to get the image in .png or .jpr or .gif format as a 2D image. I want that the user can see the image of the object within the stl file that he/she uploads. I am using PHP.
Please assist me how can I achieve this using PHP. I shall be very thank full to you.
You could use ParaView www.paraview.org in the backend. This is free and reads stl as well as having the ability to save images. There is a python interface, so you can program it to do various things (starting by tracing your actions in the GUI). You can also give it options from the command line. ParaView has a web component, but it would probably be easier just to have PHP do a system call and look for the resulting image.
Test that it works on the command line before wrapping it in PHP

Resources