extensions icon indicating copy to clipboard operation
extensions copied to clipboard

Placing images back in the folder they came from

Open mrobraven opened this issue 5 years ago • 9 comments

Extension name

This feature request is for extension: storage-resize-images

What feature would you like to see?

I'm not sure if this is already possible but basically for an app that I am currently developing, user's profile photos are stored in their individual folders and I plan to use the wildcard feature to resize these images:

profile-images/user1/cover.jpeg profile-images/user2/profile.jpeg etc....

profile-images/*/

Is it currently possible to grab the image, resize it and place it in the same directory when using the wildcard like that?

mrobraven avatar Jul 10 '21 11:07 mrobraven

Hi @mrobraven.

Yes this is currently possible by using the cloud paths configuration.

image

Within the extension it states

You may also use wildcard notation for directories in the path. For example, `/users/*/pictures` 

Added profile-images/*/ within this configuration should solve your problem.

Please let us know if this is the solution you are looking for.

dackers86 avatar Jul 13 '21 08:07 dackers86

Hi, will this put the images back into the same place? The parameter you have suggested appears to just define where to look for photos (which I have already done) as oppose to where to put them after. Are they put in the same place after automatically if you don't set a location? Thanks

mrobraven avatar Jul 13 '21 08:07 mrobraven

I have the same situation and I'm looking for the same thing. it will be nice if the resized image just overwrite the uploaded image at the exact same path as the original image.

omerozk avatar Sep 29 '21 13:09 omerozk

Are you looking to replace the image altogether (keeping the original name) or store the <name>_200x200.png image in the same directory as the original?

Ehesp avatar Sep 29 '21 16:09 Ehesp

yes replacing the image (the original image will be overwritten) at the exact same path if possible keeping the name otherwise I'll adapt my code with the size suffix. I don't need the original image once I have the resized one. I just need to keep the same path.

omerozk avatar Sep 29 '21 16:09 omerozk

Could you try setting the RESIZED_IMAGES_PATH param to /? This should add the resized image to the same directory. As for overwriting the original, this isn't supported but I'll add it as a feature request.

Ehesp avatar Sep 30 '21 12:09 Ehesp

Could you try setting the RESIZED_IMAGES_PATH param to /?

I don't have this extension on my project yet , while configuring I wasn't able to define to save the resized image to the same location as the original image. So i'm not really able to test if setting / will work.

I'll probably wait for the overwriting feature to be done to do the implementation all at once for this extension.

(If you wanna give a try to your proposition feel free 🙄 and please let me know 🙏 😄 )

omerozk avatar Sep 30 '21 15:09 omerozk

Hi @mrobraven and @omerozk,

Just to confirm for you both I have a run quick test. If you would like to store resized images in the same folder please use @Ehesp solution with setting Cloud Storage path for resized images to / or keep it empty. It is working with wildcards paths too.

@omerozk We already have another issue #653 about keeping the same file name. Please keep track of this one for the feature request.

Please let me know if that helps.

posiek07 avatar Feb 10 '22 15:02 posiek07

Closing as some solutions have been offered. As mentioned https://github.com/firebase/extensions/issues/653 this Extension now supports EventArc functions to run when an image has been resized.

This should allow more flexibility for the above edge cases.

dackers86 avatar Oct 10 '22 13:10 dackers86