How to set image received from a web service as ImagePaint in Blackberry 10.1? - qt

I am populating a QVariantMap with JSON data which I'm getting from a web service. This data contains, among other things, URL for images. Now I want to use these images as ImagePaint in my qml file, but in Blackberry OS 10.1, setting the imageSource to the URL doesn't load the image.
What is the way around this problem? Thanks.

You can use a WebView to display your image like the following:
Webview {
url: "link/to/your/image"
}

Related

Xamarin Forms - Android Images Not Appearing

When I run my app on an iphone, all the images come up great. But when I tried running it on an android, none of the images showed up at all. The images were placed in both the ios and android folders (Android/Resources/drawable).
Anyone know why the images don't appear on an android?
I solved this exact problem by loading the images in the code behind.
The only way downloaded or filesystem retrieved images outside of the projects namespace work in Xamarin.Forms for Android is in the codebehind. Binding to the ImageSource will not display them. The problem has something to do with OnAppearing never setting or refreshing the property even if you set WidthRequest and HeightRequest. I'm actually not sure why but I have tested this process for a couple of weeks with no success. What I mean by this is the ViewModel is where you retrieve the image from a WebService or from the Filesystem then get and set your ImageSource this code typically will run on creation of the ViewModel or OnAppearing. There is a bug in the system with XAML so it will never work. Using the Codebehind and setting it directly is the only way the images will display. I don't know why this behaves this way but I have tested every conceivable way to do this and it does not work with ImageCircle or Image whether you set the ImageSource.FromFile or ImageSource.FromStream. It does work when you set the ImageSource in the XAMLs code behind using the Image object directly. If you read through this article on Images in Xamarin Forms it will explain which ways you can use XAML and display the the images using Embedded Resources and using.
https://developer.xamarin.com/guides/xamarin-forms/working-with/images/
<Image Source="{local:ImageResource WorkingWithImages.beach.jpg}" />
The only runtime ImageSource binding that seems to work is using a web address and pulling from the URI.
<Image Source="https://xamarin.com/content/images/pages/forms/example-app.png" />

Why does ReportViewer image to Azure Blob Image results in an empty source?

I have uploaded some images to Azure blob storage (sample) which need to be referenced from a ReportViewer.
Right now, i have an image control bound to the results of a stured procedure that lists a couple images based on some criteria. The SP is outputting the list of images correctly (the sample link being one of them) but all i get from the image control is an empty block wrapping an img with an empty src.
The behaviour is still present even if i hardwire the sample image link into the image control instead of binding it to the query results (Only difference being that i now get a proper image in the Visual Studio preview).
I have tried disabling all proxies, whitelisting my azure blob domain from the default proxy but have met no success.
Right now my app is running on my development machine.
Update:
Hardwiring the sample link into the image control somehow works now, but i am still facing the main issue: databinding the image control to a sp-produced value results in an empty src. Setting the image source to external and the image to [RValues] is still not working. (Setting a text control to [RValues] will output a valid absolute url pointing to the correct image so i doubt that's the problem)
Update 2: The image is showing as a red x on the PDF export
Your question has nothing to do with Windows Azure.
In order to reference external images into your reports you need to do a couple of things. First of all you have to enable external images in your report viewer control:
ReportViewer1.LocalReport.EnableExternalImages = True
Also you need to set the source as external. And last but not least make sure the reportviewer httpHandler is properly registered with the web.config.
For more information check the relevant question here and documentation here.
If you're using Azure Storage SDK to upload the blobs, you're probably not specifying content type. By default Azure Storage assigns application/octet-stream to them and serves them using this content type when you access the files via url. ReportViewer doesn't work well with external images served like that.
So when uploading the image, make sure to specify ContentType property of the blob.
var blockBlob = container.GetBlockBlobReference("your-image.jpg");
blockBlob.Properties.ContentType = "image/jpeg";
await blockBlob.UploadFromStreamAsync(stream);
public async Task SaveFile(byte[] bytes, string feature, string fileName, string tenant)
{
CloudBlobDirectory blobDirectory = GetImageStorage(tenant, feature);
CloudBlockBlob blockBlob = blobDirectory.GetBlockBlobReference(fileName);
blockBlob.Properties.ContentType = "image/jpeg";
using (var ms = new MemoryStream(bytes))
{
await blockBlob.UploadFromStreamAsync(ms);
}
}

Uploading and image dynamically at runtime in Flex 4.5

I am building a form builder in Flex 4.5. For that I need help regarding uploading image at runtime such that any user can just simply place cursor on particular location on image and is able to upload any image from the local file system.
Maybe try using native extension or native process. But this is only possible with AIR.
Here is a simple example:
http://thanksmister.com/2011/03/16/upload-s3-curl-air-nativeprocess/
I hope this helps :)
Could you describe more what you are trying to do?
It's fairly simple
private function browseForFile():void
{
fr = new FileReference();
fr.addEventListener(Event.SELECT,handleBrowseForFileSelected);
fr.browse([]);
}
protected function handleBrowseForFileSelected(event:Event):void
{
fr.removeEventListener(Event.SELECT,handleBrowseForFileSelected);
fr.upload( ...)
}
in fr.upload fill the parameters as you need, basically a URLRequest to which you will upload the file to.

Create dynamic images from WPF User Control inside an HTTP Handler

I'm using Microsoft's PivotViewer control in one of my Silverlight projects. I'm creating a JIT collection and was hoping to dynamically generate the images based on the rendered result of a WPF UserControl. In order to generate the images I'm using an HTTP Handler to serve the images up dynamically.
Can anyone point me in the right direction on how I might best go about this. It's all quite a mashup of technologies and a bit difficult to know where best to begin.
Thanks in advance.
EDIT: I have found a guy that's done this in ASP.Net MVC here -
If you want to stream on the HTTP stream a WPF visual, the pseudo code would be something like this:
RenderTargetBitmap bmp = new RenderTargetBitmap(width, height, 96, 96, PixelFormats.Pbgra32);
bmp.Render([your WPF visual or control instance]);
// choose the format if you want something other than png
PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(bmp));
// stream this on the web
png.Save([the web stream, like Response.OutputStream]);

Can I open a browser window to view an image created by a flex 3 application?

I have a flex 3 application that creates an Image from a canvas which the user draws on. I use the ImageSnapshot class to create the image
var imageSnap:ImageSnapshot=ImageSnapshot.captureImage(myCanvas);
var imageByteArray:ByteArray=imageSnap.data as ByteArray;
I want the user to be able to print or save the image. I can use the following code to print the image but flex does not provide good control over printing across multiple pages
var printJob:FlexPrintJob=new FlexPrintJob();
printJob.start();
printJob.addObject(myCanvas, FlexPrintJobScaleType.SHOW_ALL);
I would like to display the image in a browser window so that the user could print it using the built in browser functionality or right click on the image and save it. Can this be done without requesting server side code to do it?
I know that flash player 10 and flex 4 allow you to save files locally but for now I am stuck with player 9 and flex 3
You can still use the new features of FileReference (the save() and load() methods) in Flex 3 as long as the application is running in Flash Player 10. But if you are definitely stuck with Flash Player 9 then you will need to push the image up to the server first. If you are looking for a good way to push that data up to the server, please reference my solution in this question:
Flex: Render an unrealized UIComponent to BitmapData?
I don't believe you can do this, as it would violate the sandbox. For example, if this worked, it means you could put arbitrary code (analogous to an image) on the user's machine without their consent or knowledge.
I'm not sure if this will work, but try this:
Show a link to the image (file://path/to/image/img.ext) and set window.htmlLoader.navigateInSystemBrowser = true;

Resources