Optimize and host images in Azure? - image

I'd like to host images for my website on Azure. The images should be compressed and available in different resolutions.
Of course, I could just compress and scale the images by myself and put them in a blob storage.
But is there a way to let Azure do the work for me?
I want to upload an image in a very high resolution and Azure should create versions in different resolutions and compress them. After that the image should be published so that I can retrieve it from my website.
Is there a better way to host images than Azure blob storage?

You can create an Event Subscription that will respond to the blob storage uploaded event, after that, an Azure Function will be triggered and will handle the event by creating a resized version of an image and copying it to a separate storage container. This is an auto-scale solution. An example that exactly describes your situation can be found on official microsoft docs page Tutorial: Automate resizing uploaded images using Event Grid.
Event Grid enables Azure Functions to respond to Azure Blob storage events and generate thumbnails of uploaded images. An event subscription is created against the Blob storage create event. When a blob is added to a specific Blob storage container, a function endpoint is called. Data passed to the function binding from Event Grid is used to access the blob and generate the thumbnail image.

Related

botframework get attachment api returns with 404 for old images

Background
We are using the following api to fetch image data uploaded from our user via bot.
The API reference is the following.
https://learn.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#get-attachment
And the use case is the following.
User pasted image along with text and send message to bot.
The following image is the [bot side].
We are fetch the pasted image data and show it on [our app side].
The following is our app side.
Issue
But we found that for the images uploaded [1 month ago], the API returns with 404 http code and we could not get image data anymore.
For the images uploaded recently, The api responsed with 200 and image binary data which we can take usage and show it.
Question
Is it possible that MS side put some restriction for pasted image that uploaded to botframework blob storage more than a month?
It's important to note that the Azure Bot Service's Connector service is not a storage service. When attachments are sent to/thru the Connector, Azure will store the attachment for no more than 24 hours.
If you are needing to access attachments sent days/weeks/months ago, then you should utilize Azure Blob Storage, or some equivalent service, to meet those needs.

PWA app to detect when camera on mobile has taken a picture

I want to launch a Progressive Web App whenever a camera on a mobile device has taken a picture.
When a picture is taken I want to captured extra metadata and upload the picture to a server in the cloud and the metadata to a database in the cloud. I know how to upload pictures and metadata.
I want to launch the Progressive Web App when pictures are taken to enable the user to enter extra metadata and store the picture in the cloud.
Is it possible and where can I find information on how to accomplish this?

Is there any way for Amazon lex to print/render image on a php website? (webhost000)

Im using amazon lambda for the backend for the chatbot and I have no idea how to let the chatbot generate the image from my website. I read about custom payload but the documentation is very sparse and lack in information. I tried to send it with html tags in the content and in json format but both did not work. Dialogflow for example has very straightforward documentation in generating the image but somehow amazon lex makes it hard for me.
Please have a look at this answer on a similar question: https://stackoverflow.com/a/69633494/8880593
Perhaps consider storing the images in an S3 bucket then returning the image link using the ResponseCard or GenericAttachment feature.
You could secure the image through the use of presigned URL's. Storage capacity on S3 can be managed through the implementation of a lifecycle policy to automatically delete these images after a specified period of time.
S3 - Sharing an object with a presigned URL
S3 - Expiring Objects

Is it possible to serve images from Firebase static hosting?

I have a simple Firebase web application which is hosted on Firebase static hosting service where you can upload a picture with some textboxes and it gets stored in the Firebase realtime database like this:
{
name: string,
description: string,
picData: base64 string
}
Now I would like to serve this image via a HTTP Get request. Is that even possible?
Something like: http://myawesomewebsite.com/getImage?name=x
The same like https://picsum.photos/ does it.
To be able to serve content from the Firebase Realtime Database on a GET request, you will have to extend the functionality of Firebase Hosting using Cloud Functions for Firebase or Cloud Run.
The Connect Functions to Hosting section explains the steps required to serve a "bigben" page that could quickly be adapted to decode the base64 in your database and return the data. Be wary that you must also specify the image's mime type (e.g. image/png, image/jpeg) when serving the image which you don't currently store in your database.
While possible, I would recommend storing your images in Firebase Storage instead. This will help keep track of meta data such as sizes, mime types and upload times whilst not clogging your database with files stored in Base64. Images stored on Firebase storage can also be retrieved via a GET request by the client SDKs or served from a Cloud Function.

Set content type of azure blob to image in WP7

I am uploading a stream of photo from my phone camera to azure. I am uploading e.ChosenPhoto which is a stream of the taken photo and i am using blob.Metadata["ImageType"] = "image/jpeg"; but still, when the photo is uploaded the content is marked as application/octet-stream and when i go to the url the browser download the photo instead of displaying it.
What steps do i need to do in order for it to make it jpg ?
EDIT: it seems that the library that comes with WAT for WP - WindowsPhoneCloud.StorageClient.dll
doesn't support blob.Propeties at all. (maybe because WP only support async calls ?) Is there any workaround on setting the content type ?
Try setting blob.Properties.ContentType = "image/jpeg".
Unless the SAS is used, it is highly recommended that we use a cloud service to upload blobs. If we upload a blob directly from Windows Phone without SAS, we have to embed our storage account key in the Windows Phone application. If a hacker gets the key, he will obtain full control of our Windows Azure storage account. For example, he can upload several TB data to the storage, and requires us to pay for the data. So instead of trying to upload the blob from Windows Phone, please try to host a service in Windows Azure. We upload the image to our service, and our service saves the file in blob. As long as we don’t return the storage key in any response, it will be safe.
If we have to upload directly from Windows Phone without SAS, we may need to manually use the REST API for the scenario to work. According to http://watwp.codeplex.com/discussions/352111 , the WAT library doesn’t allow us to specify a content type. In addition, I would like to point out that WAT is just a toolkit. It is not a built-in Windows Azure component.
Best Regards,
Ming Xu.

Resources