Hi looking to upload images to the media format, and then return a link to the said image when it has become available.
Ultimately this is to generate one of those fake signatures from someone's name, probably in base64 format, then in turn upload that image, and use the link in an email.
Are you trying to upload images to the Media library programmatically from the front-end of the site? If so, you'll need to use the Media Service to create the items.
Hi Dan, yes that's right, I am turning a Name + Surname into a 'fake' signature, (you know where its literally just Your Name but in squigly italics) in form of a base64 string, and in turn upload that image to the media, get the URL of the said image, embed it into an <img> tag and email it off.
I already have the base64 part, so I do have an image ready to upload.
I see thank you, it does make some sense, though I am still struggling a bit, mainly because the image I have is generated from a canvas like so;
var sigUrl = canvas.toDataURL().toString();
And then for this early implementation, I am injecting that into an image tag, but id like to swap it to be uploaded to Umbraco, and then the URL for the image injected instead.
I run it all on a form submit, do you think it would be possible to have the form submit, upload the image, get the URL, put the URL into the image tag, and send the email?
Add image to media folder from front end
Hi looking to upload images to the media format, and then return a link to the said image when it has become available.
Ultimately this is to generate one of those fake signatures from someone's name, probably in base64 format, then in turn upload that image, and use the link in an email.
Thanks!
Are you trying to upload images to the Media library programmatically from the front-end of the site? If so, you'll need to use the Media Service to create the items.
https://umbraco.tv/videos/umbraco-v7/developer/fundamentals/media-api/introduction/
https://techiespice.com/2018/11/01/create-folders-upload-images-under-media-in-umbraco/
Hi Dan, yes that's right, I am turning a Name + Surname into a 'fake' signature, (you know where its literally just Your Name but in squigly italics) in form of a base64 string, and in turn upload that image to the media, get the URL of the said image, embed it into an
<img>
tag and email it off.I already have the base64 part, so I do have an image ready to upload.
This snippet is taken from a older project and might need some cleaning up but it should get you started:
Hi Frans, thanks for this, do you know which part of this code is the 'source' image, just trying to understand it.
Hi Kieron,
New image is a property on the edit model:
Is this the part you are looking for?
So first get the mediaService, after that I do some checks to see if there is a new image.
After that I check if the folder I want to store the folder in exists and if not (else if) I create the folder.
Finaly I create the new image, save it and add it to the current publishedcontentitem I am working on.
Does that clarify the code?
Frans
I see thank you, it does make some sense, though I am still struggling a bit, mainly because the image I have is generated from a canvas like so;
And then for this early implementation, I am injecting that into an image tag, but id like to swap it to be uploaded to Umbraco, and then the URL for the image injected instead.
I run it all on a form submit, do you think it would be possible to have the form submit, upload the image, get the URL, put the URL into the image tag, and send the email?
What you could do is send the image to a surfacecontroller with a variation on my code.
The Url is the part you want to return and show via a ajax call or page reload or whatever you choose.
Is this what you were looking for?
is working on a reply...