ReportViewer WPF - Set Images Dynamically - wpf

I'd like to load image(s) at runtime (dynamically) into my report (inside the header).
I've already create the following parameter:
Name: Path
Datatype: String (should be the path to the image)
Allow Blank = True
Then I've draged and droped an image control to my report.
Set the name to: Image2
Imagesource: External
Use the following image: [#Path]
Now (back in my MainWindow) I've added the following code:
viewerInstance.LocalReport.EnableExternalImages = true;
List<ReportParameter> param1 = new List<ReportParameter>();
//header_2.png exists (for test purposes) in the root folder
param1.Add(new ReportParameter("Path", #"/header_2.png"));
viewerInstance.LocalReport.SetParameters(param1);
It doesn't work.
I'll get this error message:
The invocation of the constructor on type 'ReportViewer.MainWindow' that matches the specified binding constraints threw an exception.
{"The source of the report definition has not been specified"}
Any ideas?

I am not very sure about how to do it with External Images using the absolute path in SSRS 2008. But I guess I can provide with a workaround but this would work only in case you have all the images that you would be using in reports available to you beforehand.
You can add an Image control to the report. In the Image Control property, provide name, select the image source as Embedded, and click on Import, and select the image. Click Import. The image is imported. Now you can import all images like this. Once done, go to Image control property again and set the Use this Image as "[#Path]". Now you do not need to pass the absolute path but only the image name amongst the imported images which you can see under images in Report Data.
Also, if you want to use External Images, as per this msdn article you need to provide the Url for the image and not the absolute path. In this case you can hoist your image on a server and pass the path in the Path parameter. Select the image source as External. I have tested this and it works.
Edit: You can also upload the images to the ReportServer through the Report Manager and provide the path to that image as the relative path in the RDL after you specify the Image Source as external. e.g. /Report/Logo.png. You can also upload multiple images and use them by providing the path as parameter to the report.

Related

How to download images and bounding boxes from imageNet such that they have matching names?

I am doing object detection for a specific class, say, chairs .
I want to download images of chairs from imageNet. I also want to download the annotation xml files (bounding boxes) from imageNet.
Both these things are provided on imageNet and I have successfully been able to download them using a tool called ImageNet_Utils
https://github.com/tzutalin/ImageNet_Utils
But the downloaded images and bounding boxes don't have matching names. So it is impossible to tell which xml file is for which image.
How do I download images and bounding boxes from imageNet such that corresponding image and annotation xml files have matching names?
The download image URLs page says
The URLs are listed in a single txt file, where each line contains an
image ID and the original URL
Unfortunately, as of 2020-03-06, all the URL mapping files link to a Oops! The URL is not valid page. However, can however get mappings for each node individually. They are available by wnid: http://www.image-net.org/api/text/imagenet.synset.geturls.getmapping?wnid=n03273913
A bounding box annotation file will contain this element.
<filename>n03273913_16800</filename>
The n03273913 is the synset id and the 16800 is the image id. In the synset mapping file you'll find the line
n03273913_16800 http://farm1.static.flickr.com/186/425238103_8fe80b37de.jpg
You can download the image from that location.
There's a c++ library known as dlib. You can pass your downloaded images from dlib, it has GUI support for drawing blocks in images and save them in vector formats in an XML file. You can refer here for the documentation

WPF cannot set Build Action for added file [duplicate]

I would like to assign a BitmapImage from my Resources.resx to an Image.
Beforehand I saved a .png image to Resources.resx. This image is now located in "/Resources/logo.png".
After reading several SO posts and other articles I have this now:
logoImage.Source = new BitmapImage(new Uri(#"pack://application:,,,/Resources/logo.png"));
Unfortunately it doesn't work.
I don't know how to solve this.
I tried to replace the Pack-URI with the fullpath and it worked but I would like to use relative paths in order to use the same source on different machines on which the absolute path would be incorrect.
Can anyone help me out with this?
In order to make that Uri work, the file logo.png must be contained in a folder named "Resources" in your VS project (see first image), and its Build Action must be set to Resource (see second image).
This Resources folder is completely unrelated to Resources.resx. You may rename it to whatever you like.

Setting SSRS BackgroundImage Source from field

I'm working on an SSRS template at present which pulls lots of its format information from a database. Part of this format information sets the Background Image of cells.
I'm currently filling the image by setting the Source to External and pulling its value from the database. This works lovely, however It means pulling the image from a network source each time and while a small efficiency hit, I'd like to try and remove that pull if possible by embedding the standard images.
Again this works fine, I can pull either an external image or an embedded image and display on screen. The problem comes when I'd like the option to do either.
I find that I cannot set the image Source from a field, there isn't an option in the GUI.
I've tried going into the code and entering the details there but I get a validation error:
The 'http://scemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition:Source' element is invalid - The value =First(Fields!bodyBackgroundImageSource.Value, "dsTemplate") is invalid according to its datatype String - The Enumeration constraint failed".
Has anyone else come across this and found a solution or know of a workaround? I can continue using only external images, but would prefer to avoid as many external calls as possible.
In our local environment, we tested this scenario and if the expression can return the correct image name, then the image can display properly. You can check if the "First(Fields!bodyBackgroundImageSource.Value, "dsTemplate")" expression return the image name existing under Images folder on Report Data window. And make sure the image source is embedded.

Adding image in java code in code name

I am new in code name one. I have to add image in a container(flow layout) with specific width and height.
1: codenameone's guide says that we have to add image in resource folder. Where is that resource folder?
2: To create image i am using createImage(path) of image class. if we put image file in resource folder then what is path of that image.
3: Is here any type restriction of image file in it.
Please help.
When you put the image you would like to add in your src folder the code should look as followed:
Label i = new Label();
Image img = Image.createImage("/imageToAdd.png");
i.setIcon(img);
You can change the label to whatever object you would like to use to display your image.
Resource file not folder, the ".res" file in the root of the SRC directory contains your theme as well as additional images you might need. The value here is that you can add multi-images (see tutorial) as well as write very portable code.
You can access the resource file in a GUI builder via fetchResourceFile() or in a non-GUI builder app using Resources.open (as is demonstrated in the init method).
You can also place arbitrary JPG/PNG files in the src root next to the res file. While there is no restriction from Codename One, devices tend to support PNG/JPG well and might fail with other formats.

Drupal Images Slideshow

I'm making a website in drupal 7 and need some help.
I created a content type called Itenary where user will upload information and five images.
The images I have taken as Image1, Image2.... Image5 as fields of type image pf the itenary content type.
Now I wish to show these images as something like this
So I go to the views module -> add new view
Now when I had tried this before, I had selected
Show content of type itenary
And it didn't work as I hoped.
So this time, I chose
Show File of type Image
I hope this is the right option for my need.
Then I went to create a block, gave it a name.
Now my dilema is how do I bring those fields of Image1 Image2 .. Image5 into this block ?
The fields it shows by default are related to files and not the field of my content type.
Make sure you have the following steps checked.
1- Try to download jQuery cycle plugin.
2- Create a folder a new folder sites/all/libraries/jquery.cycle and place jquery.cycle.all.js file inside it.
3- Go and test the results :).
Hope this works... Muhammad.

Resources