question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resize Image - Callback

See original GitHub issue

This feature request is for extension: _ (storage-resize-images)

It would be great to see a callback included in the extension to be able to get information about the new image that has been created.

For example,

  • you have the extension configured on a bucket
  • you upload the original image to the bucket and await a callback
  • when the new resized image has been created the callback includes information about that new image

This would make the extension more useable and make it a lot easier to know when the image has been created, and easier to go fetch it.

Thanks.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:20
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

16reactions
karayucommented, Nov 26, 2019

Hi @ltbmedia thanks so much for this feature request!

We’ve reviewed this as a team and think that the best solution long term is better lifecycle management for an extension: a way to understand the status of an extension (when it’s executing and when it has finished) and a way to trigger an action based on a status change from an extension. We’re thinking through this problem long term and to @Ehesp’s point, this is a feature that would benefit many extensions.

Unfortunately, in the short-term, there is no easy fix for this. I’m closing this for now but we will be tracking this internally in our long term roadmaps.

Thanks again for the feedback! Kara

7reactions
ltbmediacommented, Nov 14, 2019

Hi Aliaksei, You can get the resized image by using ->

let gsReference = this.storage.refFromURL(‘gs://your-bucket-name/’ + filename + ‘_200x200’ + fileExtension)

You can only call this and get the resized image from the bucket once the resize-function has completed, otherwise you get an error because the new resized image does not exist yet - only workaround is using a delay before calling that which isn’t a great solution.

This is why we need a callback in the function to let us know that the new image exists, and has been completed. We also need the new image information so that we don’t have to string together a reference url!

Hope this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image::resize | Intervention Image v2 | intervention.io
Resizes current image based on given width and/or height. To constraint the resize command, pass an optional Closure callback as third parameter.
Read more >
Image - Callbacks - Imperavi
Triggered before the image will be deleted. This callback allows you to prevent image deletion if you return false .
Read more >
Resize Images | Extensions Marketplace by Firebase
Resize Images. Made by Firebase. Resizes images uploaded to Cloud Storage to a specified size, and optionally keeps or deletes the original image....
Read more >
Window: resize event - Web APIs | MDN
The resize event fires when the document view (window) has been resized. This event is not cancelable and does not bubble.
Read more >
resizing an image before saving in state in React
First of all your handleResize function doesn't always return value. But generally what you need to do is to use callback in your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found