Upload Photos using Silverlight - Ria Services - web-services

i'm trying to find a good exemple on uploading and downloading images using solely Silverlgith + Ria Services, i tried to find some but i failed, please any help would be appreciated.
thank you all in advance

I just found some useful walk trough here and make sure to read follow-up that improves the save process and used image

We did it by saving the images on disk (not in a DB) - like this:
Upload image:
Write a Domain Service with an operation like void UploadJPGImage(string uniqueName, byte[] jpgBytes). This needs to be marked with the attribute for ClientAccess. The (server-side) implementation saves the image on the disk.
for the uniqueName, we generate a GUID client-side
Download image:
HTTP Handler - write an HTTP handler for downloading the image using a URL containing the unique name parameter passed by the client when uploading the image
Or, one could write a Domain Service operation, like byte[] DownloadJPGImage(string uniqueName)

Related

Correct way to fetch data from an aws server into a flutter app?

I have a general understanding question. I am building a flutter app that relies on a content library containing text files, latex equations, images, pdfs, videos etc.
The content lies on an aws amplify backend. Depending on the navigation of the user in the app, the corresponding data is fetched and displayed.
I am not sure about the correct way of fetching the data. The current method (which works) is that the data is stored in an S3 bucket. When data is requested, the data is downloaded to a temporary directory and then opened and processed in the app. This is actually not slow, but I feel that it is not the way it should be done.
When data is downloaded a file transfer notification pops up, which bothers me because it is shown all the time. Also I would like to read the data directly with something like a get request, without downloading the file first (specially for text files, which I would like to read directly into a String). But here I don't know how it works, because I don't see that you can save data in a file system with the other amplify services like data store or the rest api. Also, the S3 bucket is an intuitive way of storing data that is easy to use for the content creators of my company, for me it seems that the S3 bucket is the way to go. However with S3 I have only figured out the download method to fetch data.
Could someone give me a hint on what is the correct approach for this use case? Thank you very much!

AWS S3 filename

I’m trying to build application with backend in java that allows users to create a text with images in it (something like a a personal blog). I’m planning to store these images to s3 bucket. When uploading image files to bucket i’m hashing the original name and store the hashed one in the bucket. Images are for display purpose only, no user will be able to download them. Frontend displays these images by getting a path to them from the server. So the question is, is there any need to store original name of the image file in the database? And what are the reasons, if any, of doing so?
I guess in general it is not needed because what is more important is how these resources are used or managed in the system.
Assuming your service is something like data access (similar to google drive), I don't think it's necessary to store it in DB, unless you want to make faster search queries.

Google Vision - Batch Image Annotation, map result to request images

I'm using Google Vision to detect text in images (on my backend written in kotlin).
I want to do a batch request with multiple images from a web url but the problem I'm facing is how to know what results maps to what image in the request?
Can I rely on Google to return the result in the same order as I put them into the batch request?
Currently I do not get any information in the response that I can use to figure out to what image the annotated text belongs to. And it's important that the text can be mapped to the correct image.
If you need more information please let me know and I'll provide it to you.
The responses are in the same order as they are in the request.

Display ".doc" ".docx" in browser

My users can upload their CV and this CV should be seen by any employer.
My problem is that my client want this CV to appear in the web browser without any download.
PDF work fine but doc & docx don't.
I've tried to use both gem ("docx" and "doc_ripper") but each one can just handle basic thing (table won't work ...)
The cv is attached to one user and stored on Amazon with Dragonfly
I've try the google view : http://googlesystem.blogspot.be/2009/09/embeddable-google-document-viewer.html
But as I do : user.cv_file.remote_url(expires: 5.minutes.from_now)
The url doesn't work anymore (this solution only work if the document is public)
I thought to make a second field which have the cv_file convert as a pdf if it's not.
Any possibilities to give a public permission to aws file for 2-3 min (time to render it with google view tool)
Thanks.
I assume you are talking about a file stored on S3. To make a file on S3 temporarily public you can generate a pre-signed URL with an expiration date/time: http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html
I've used the gem htmltoword a few times now and it's done a good job from that end of the translations.
I did a quick search and there are a few promising gems that might help you out here - converting the resumes from Word (.doc, .docx) into an format that you can get to HTML for your views (perhaps storing this converted content in a DB table/column?).
Word docx_converter
Google Groups discussion of the issue
ydocx
docx
Thanks for answering but after many research, I finally found :
https://view.officeapps.live.com/op/view.aspx?src=
which work as well as the pdf reader from browser.
Be sure to have a public url for the file you want to display

How do I track images embedded in HTML?

I'd like to track the views/impressions of images on web pages, but still allow the images to be embedded in HTML, like in the "img src="http://mysite.com/upload/myimage.jpg"/" element.
I know in Windows I can write a handler for ".jpg" so the URL will actually trigger a handling function instead of loading the images from disk. Is it possible to do that in python/django on Ubuntu server? Can web browser still cache the jpg files if it is not a straight file path?
It looks to me that this is how google picasaweb handles the image file name. I'd like to get some ideas on how to implement that.
Thanks!
-Yi
If you want images to not be cached, just append a timestamp to them. This example is in PHP, but you get the idea:
<img src=<?php echo '"../images/myimage.gif?'.time().'"'; /* Append time so image is not cached */ ?>
Then you can analyze your logs to track views, etc.