maily.to icon indicating copy to clipboard operation
maily.to copied to clipboard

Inserting images from clipboard/downloading from a computer

Open doroved opened this issue 10 months ago • 15 comments

I propose to add inserting images from clipboard/uploading from computer to make it faster and more comfortable to create a template, because it takes much longer to prepare an image from a link. And when copying HTML code, images should be replaced with links, e.g. https://cdn.img.com/cat.png, where cat is the name that can be requested when inserting an image.

doroved avatar Apr 09 '24 15:04 doroved

If we do it we need to handle the hosting part of the images, which will be a bit costly. What do you think?

arikchakma avatar Apr 09 '24 21:04 arikchakma

If we do it we need to handle the hosting part of the images, which will be a bit costly. What do you think?

I must have explained it badly. Look, for example, we pasted an image from the clipboard and saved it in IndexDB. After exporting HTML code in place of the image will be, for example {{ CAT }}, where CAT is the user defined name of the image after pasting from the clipboard. This way we can create templates much faster and after we create, export, upload our images to our server or somewhere else and replace insertions like {{ CAT }} with links. It's just that if when I create a template I have to go through a lot of different pictures to choose the best one, it's very stressful to upload them somewhere.

P.S. If the application is used locally, you can use sqlite to store the images

image

doroved avatar Apr 10 '24 00:04 doroved

Ah, It's an excellent idea. I will think about how to implement it and start soon (I might take some time as I'm taking a break right now).

arikchakma avatar Apr 10 '24 19:04 arikchakma

Hey @doroved I was thinking about this solution. We allow saving templates, this might be an issue for that. Let's say someone save one template (with images) and try to edit it from somewhere else, the images will not be available there right?

arikchakma avatar Apr 17 '24 08:04 arikchakma

Hey @doroved I was thinking about this solution. We allow saving templates, this might be an issue for that. Let's say someone save one template (with images) and try to edit it from somewhere else, the images will not be available there right?

Hi, well for your site yes, without cdn storage this script will not work. But for local use it will be ok. For the site, you can not save images and warn about it. But quickly design templates due to copying images from clipboard/downloading from computer, it will improve DX and save time.

doroved avatar Apr 17 '24 09:04 doroved

Hey @doroved I was thinking about this solution. We allow saving templates, this might be an issue for that. Let's say someone save one template (with images) and try to edit it from somewhere else, the images will not be available there right?

Hi, well for your site yes, without cdn storage this script will not work. But for local use it will be ok. For the site, you can not save images and warn about it. But quickly design templates due to copying images from clipboard/downloading from computer, it will improve DX and save time.

It will break the workflow for the site, what I can do is expose some low level API for onImageDrop or similar so on local you can upload it wherever you want to. Wdyt?

arikchakma avatar Apr 17 '24 10:04 arikchakma

It will break the workflow for the site, what I can do is expose some low level API for onImageDrop or similar so on local you can upload it wherever you want to. Wdyt?

Any implementation that will allow inserting images from clipboard/downloading from computer - will be appreciated by the community)

doroved avatar Apr 17 '24 10:04 doroved

Any implementation that will allow inserting images from clipboard/downloading from computer - will be appreciated by the community)

I do have the plan to integrate S3, just the way we support sending test emails using Resend. Bring your own key way. I think it will be a much more suitable way to do it.

arikchakma avatar Apr 17 '24 10:04 arikchakma

Also consider adding alt text input for the images, as sometimes the link might be broken or from accessibility point of view

Something like this maybe: alt text modal

Also, for horizontal logo / word logo, the logo seems stretched. We could contain it by default to fix this. Like in this example: Screenshot 2024-04-27 005918

meoawww avatar Apr 26 '24 18:04 meoawww

The logo is expected to be a 1x1 Aspect ratio, but I will still look into it. I liked your idea for the Alt text, currently, I'm thinking of adding more customization to the editor (I'm too busy with my other commitments right now). Maybe I will allocate some time from the next weekend to work on it. Thanks for your valuable feedback.

arikchakma avatar Apr 26 '24 20:04 arikchakma

Thanks for the response, I'm glad to know you liked my suggestion and No worries take your time.

meoawww avatar Apr 26 '24 21:04 meoawww

If we do it we need to handle the hosting part of the images, which will be a bit costly. What do you think?

Hi, you can use Cloudflare R2 bucket for storing images, they provide a free plan. we can use some image size limitations to prevent the limit exceeded.

bdhamithkumara avatar Jul 16 '24 07:07 bdhamithkumara

Next weekend I will start implementing this feature.

arikchakma avatar Jul 16 '24 07:07 arikchakma

If you wish I can contribute 😎

bdhamithkumara avatar Jul 16 '24 07:07 bdhamithkumara

I will be more than happy, but we need to discuss the API. I don't want to directly add that into the editor package.

arikchakma avatar Jul 16 '24 09:07 arikchakma