So I had a thought -- Say you have pictures streaming to your app from a webpage. Is there any way to put code in the app to find out how many times a person has tapped the image, or how many times they have pressed a button belonging to the image?
Think of the "Like" button for facebook, where people can have +1, and see the total count of how many people also "like" it.
If so, how would one go about coding this?
You question is very vague...
If you want the count of how many time the image was loaded you can count that server side every time the picture is downloaded. If you want to give them a "like" button then you can add that to your WP7 app and call a page server side or a WCF service with some ID value for the picture to track the "likes".
For example:
HTTP Version
You can download the pictures from you webserver using a link such as "http://www.mysite.com/pictures.aspx?ID=Funnyfile.jpg&DeviceID=29393848293".
ID would be the unique ID for your application to know which picture to load
DeviceID would be the Device ID for the WP7 device loading the picture in your app (MSDN doesn't recommend you use the Device ID to identify unique users so you might need to adjust this value).
You could then set the source of an Image Control to that URL to load the image.
Uri uri = new Uri("http://www.mysite.com/pictures.aspx?ID=Funnyfile.jpg&DeviceID=29393848293", UriKind.Absolute);
ImageSource imgSource = new BitmapImage(uri);
ProfileImage.Source = imgSource;
A WCF Service can use a similar manner and would allow you to pull a collection of images back from the server if you need to. The basics of building the service wouldn't be overly complicated, but I am omitting and example to save time.
Related
Backstory to the below issue:
I'm using the jQuery plugin Cropit to produce an image which I get in data URL form (the user uploads an image and Cropit allows them to manipulate it, when the user is happy, Cropit exports the final image).
This data URL is attached to the product (this is a Shopify website) via Shopify properties (in a similar way you would attach text for an engraved product) and then when the order is created, I have an app listening for new orders and I pull the data URL from the order.
From testing, I can confirm that the data URL is wrong / corrupted / broken at the time the order is placed and not being broken in transit.
Original Question
I have a bit of a weird situation and I can't find any similar situations online.
I'm being sent an image in data URL format (from Shopify if it's relevant, I have written a private app and their webhook is sending me an image)
The image is in a data URL format that starts with, as an example,
data:image/png;base64,iVBORw0KGgoAAAANSU.....
The problem I am having is sometimes (and it's maybe less than 10% of the time) when I get the image and try to print it, it's missing the bottom chunk of the image. In a PDF, it considers the image corrupt, and in a web browser, it just sees the bottom of the image as transparent, however much is missing.
This is what it looks like in Inspect Element on Google Chrome when you hover over the image URL (image has been purpled out for anonymity)
My question is, does anyone know why?
We can't find a correlation with browser or device type. And I'm not sure if it's because part of the data URL is somehow missing (maybe a character limit, because it's a really long string!) or if it's the type of image. Might possibly be something going wrong in the upload process?
Is anyone able to shed any light? It's such a weird issue I'm not even sure what to google!
And just to confirm, the image absolutely has to be sent in this format for a whole series of reasons, mainly Shopify restrictions so I can't send the image in file format.
Does anyone know how to interact with google maps street view to retrieve a batch number of images (~200) along the street view from point A to point B? I could always manually go and move along the street and "print screen." but this is time consuming. I work for city government, and we're trying to get more info on our streets.
You can take use of the Google Street View Image API, which gives you the ability to link to a picture of the Streetview directly. For example,
this link:
https://maps.googleapis.com/maps/api/streetview?size=640x640&location=40.720032,-73.988354&fov=90&heading=235&pitch=10
links to this image:
But there are 2 problems about this Google Street View Image API:
1) It only support up to 640x640, no bigger image for the free account.
2) I think the ToS requires the data be publicly accessible if you are using it for free.
You can solve these by applying to the Google Maps for Work, which I might able to refer you and get discounts.
I noticed that depending on how an image was taken or saved to the Windows Phone device, a different naming scheme may be used. For instance, a picture taken from the default camera application and saved to the Camera Roll will be WP_20131108_001.jpg, and a picture from screenshots would be wp_ss_20131108_0001.jpg, while the Saved Pictures album naming convention seems to be random based on where the picture came from. Is there a systematic naming scheme for pictures in different albums?
I need the ability to know when a picture was taken with my application or not in case it is used later (and it may be chosen from the PhotoChooserTask). I was thinking if there is no standard way to tell where a picture came from, then when saving an picture from my app I could put in a certain text value in the name and then check to see if a picture's name contains that text when being used in my app, and in that way flag to know whether a picture originally came from my application or not. Any suggestions?
You can use Album.Name functionality of Picture class to get the album name/source folder where the picture came from.And while saving in cameraroll or saved pictures you can provide a custom name for your picture.
fileName = "Camera_" + DateTime.Now;
MediaLibrary library = new MediaLibrary();
library.SavePictureToCameraRoll(fileName, stream);
I have a web application running on local host. The requirement is to load multiple rectangular jpg images (96 images, average 7k in size each) and show on home page when it runs. Images are showed in a grid of 8x12 rows/columns. I am loading image by setting the 'src' attribute of the 'img' in javascript. The url assigned to the 'src' attribute is same for all images but the image id is different. Images are loading but the main issue is that they are not loading very quickly and they are some what loading in a sequence means 1,2,3,4... and so on but some images are not loaded in sequence. I want to improve the performance of this page. I have tried the figure out the timings at different points like:
When call is originated form client (image src attribute is set)
When server is receiving call. (the page on server which serve individual image)
When server is about to return the image.
When on client side image is received/showed (image loaded event called in javascript)
It turned out after looking at the collected data that main time is lost between 1 and 2 above that is between the client side call is originated and server is receiving call for a particular image.
I have also tried setting parameters like maxWorkerThreads, minWorkerThreads, requestQueueLimit and maxconnection in machine.config but no significant improvement yet.
Can someone please help me in this situation as i am stuck here since many days and i am really short of time now. Desperately needs to improve the performance of these images loads.
Thanks in advance.
Since you stress the lack of time, I would advise you to try a jQuery plugin that loads images on demand. The gallery in which you load the pictures, does the user scroll in it? Or is it 1 big field?
If it's a gallery the user can scroll in, I'd strongly suggest you take a look at lazyload. What this plugin does, is it fetches the image only when it is needed. As long as it's not on the screen, it will not be loaded. For a brief example, have a look at this demo.
I hope this can help you out.
I have an app that allows users to take pictures and store them in the IsolatedStorage. These images are then retrieved to display them in a list. The app suffers from performance issues when there are more than 30+ images in the list. It is taking a long time to retrieve these images from the storage and bind them to the list. A lot of times, the app is just closed by OS because it takes too long.
Also, I think as better resolution devices are coming in the market, the images are getting created with bigger sizes and affecting performance even more.
I need some guidance on how to resolve this. Couple of things I have though about:
1) how can I asynchronously retrieve every image to be retrieved from IS so the page can load but the images are being retrieved in async fashion. Any sample code is appreciated.
2) the other approach will be where I create a thumbnail photo of the actual photo (smaller size and resolution) while storing the original photo and use this thumbnail photo in binding to the list later. If this should be done, then how should I go about processing the image on the fly to create a smaller size thumbnail version of the original photo.
Any other ideas are appreciated as well.
Thanks for your time.
If you are able to, I would recommend using the Async CTP and making the code that loads images from isolated storage async. The methods that generate the thumbnails can be async as well.
If you cannot do this (add these dependencies to your project), use a BackgroundWorker. Perhaps this article can help you get started.
This will allow your UI to be responsive while processing continues on threads in the background.
Do not pretend the Isolated Storage as a SQL Server. There will be great performance difference. If you want to process too much data, send them to server.
However, there is a method for getting a thumbnail. You can use it:
http://msdn.microsoft.com/en-us/library/system.drawing.image.getthumbnailimage.aspx
Also, please check this answer:
Create thumbnail image