What is the best way to generate video thumbnails? - django

I am creating an application with Vue.js and Django.
I am getting a list of videos from AWS S3 and I am displaying it in the frontend. Now I need to create thumbnails for these videos?
I want to know what is the best practice to generate the thumbnails?
Should I:
Should I generate thumbnails on the frontend side each time it receives videos?
Should I generate thumbnails on the backend side each time videos are requested?
Should I generate thumbnails on the backend and save them in the storage and then send them when the videos are requested?
Currently, I am finding solutions on how to generate thumbnails on the frontend or how to save them but no one is discussing which is the best way to do it.

preload= metadata shows a thumbnail automatically in browser, I would avoid complexity of storing the thumbnails all together, unless it is needed.
<video
src="preSignedUrlCanGoHere"
preload="metadata"
controls
controlsList="nodownload">
</video>

For some platforms/browsers (for example, iOs Safari)
preload="metadata"
won't show you a thumbnail.
You can workaround it, by adding to src timestamp (#t=0.001):
<video
src="preSignedUrlCanGoHere#t=0.001"
preload="metadata"
controls
controlsList="nodownload">
</video>

Related

How to Crop Multiple Uploads with Image Preview in Laravel 9?

I'm attempting to create a form in Laravel 9 (Repository pattern) that allows me to upload multiple images and preview them before allowing the user to crop the image and save both files (original and cropped).
Do you have any suggestions for how to approach this?
I guess you would need a combination of frontend javascript and fileupload on the laravel side. For javascript, you can look at filepond.
Alternatively, you can look at laravel filament. Filament is already using filepond as part of its form builder. It allows multiple files upload and resizing. Maybe you can start your approach from there.

How to upload images in Siebel application for further sending via web service?

im newbie in Siebel CRM.
I have a task of creating form applet that has functionality of uploading images and also some text records.
What I need to do is: send images and some text via WS(f.e. using SOAP) to external application and also save text information in siebel db.
My problem is that I cant create form applet with upload button and then submit button that processes given record as I described before.
PS: Appreciate if u give detailed information, Thanks !
Such functionality can easily be achieved using Siebel's attachment business components. For instance, under Service Requests, there is an attachments tab. Files can be uploaded here. Later for integration, your could simply use EAI Siebel Adapter BS in a Workflow, that will convert the binary attachment to base64 in the XML, which can be sent out. Users can upload any kind of file in different records.
Siebel OpenUI can show some images in Contact tiles uploaded into urls intead of files:
http://www.brucedaley.com/siebelobserver/2014/02/tiles-and-images.html
It can be done without using attachment BCs, with ordinary JS code in PR/PM file. I had to do it so users can upload PDF files, which had to be base64 encoded and sent via WS afterward but not saved in Siebel. I've used JS FileReader object (MDN) and JS out of the box base64 encoding (MDN docs).

Sharing files from google cloud storage to GAE

I have one Django application running GAE.The application uses content folder which contains images and html snippets.The content folder was uploaded in google cloud storage.I would like to render a image in static file using img tag.For using img tag I want to know the url of that image.I have seen that when we set the permission to share publicly it will give us a url.But I don't want to share that files publicly.If I share an another application can use my files.I don't want that.I there any way to do that with out log in a user
Sharing it publicly is the best way to go.
You could also base64 encode the image data when you render out the template, which means the url of the image will not be shown to the public on your page. Then you can obfuscate the image names in the GCS. This way it's still public but hard to reach.

django sorl-thumbnail json

I am using Sorl-Thumbnail to generate thumbnails within pages via template tags.
This all works perfectly fine.
However I have now added a store locator function to the site which feeds into my Google Maps JS via JSON.
In the infowindow popups I would like to put a tiny image of the storefront.
So I need to create another size of thumbnail and I need to include the URL for this within my JSON.
It seemed initially that Sorl doesnt support this due to its requirement for Tags within a page.
I have looked at the low level API version "get_thumbnail" and have tried to implement this within my Model without much luck so far.
I have no problem with my JSON and serialisation, just getting the thumbnail generated and into the model prior to this.
Has anyone had any experience with this scenario previously?
Cheers
Kev

Temporarily upload profile image in Django during registration?

In a Django application, during registration, I want the user to be able to see the profile image he/she selects, rather than just see a path as done purely using django forms (for an example of what I want see pinterests registration form). I assume it should involve some ajax upload and it should be stored somewhere temporarily since the user might choose not to proceed with the registration even if the profile image has been uploaded, in which case the uploaded picture should be deleted.
I was wondering what is the best way of handeling this? Any examples out there you can point to?
Thanks!!!
You are correct that an AJAX upload will be needed.
Whether the upload is temporary or permanent, things will not change much in your implementation much. In both cases you will need to upload the image to a directory on your web server. In the temporary case, you may delete it after a short amount of time passes.
Here is a Django AJAX uploader: https://github.com/GoodCloud/django-ajax-uploader
Option 1
You can use the HTML5 FileAPI to show a thumbnail of a user-selected image before they upload it.
Option 2
You can upload the file using AJAX and then send back a thumbnail for them to preview