# Bulk resize images in DB

**URL:** <https://forum.bubble.io/t/bulk-resize-images-in-db/212731>\
**Category:** Database\
**Created:** [June 24, 2022, 1:22pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731 "2022-06-24T13:22:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan19](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ryan19/32/125777_2.png) [@ryan19](https://forum.bubble.io/u/ryan19)\
**Post date:** [June 24, 2022, 1:22pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/1 "2022-06-24T13:22:58Z")

</div>

I made the mistake of not constraining images uploaded by users and have racked up 6GB+ of images in a few days 😬 Is there a way I can bulk resize all the images in the database? Each image is referenced in a User field.

Two things I don’t understand about it:

How to create a workflow to make changes to each user in the database  
I can’t see any action that would allowing resizing, just Imgx setting the compression quality which I already did and didn’t stop 5,000px wide images

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [June 24, 2022, 3:22pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/2 "2022-06-24T15:22:14Z")

</div>

Hello @ryan19

Explore a service called [publitio](https://publit.io/) or any other service where you can send the image and get it back compressed. Or even better … hosted there and if it allows you to change the size of the image dynamically even better! (Publitio does this)

As for “fixing” the current ones you would have to build logic and api calls to extract / transform / re-save them to your dB … or to just host them in an external service.

---

<div class="post-metadata">

**Author:** ![gerbertdelangen](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gerbertdelangen/32/144602_2.png) [@gerbertdelangen](https://forum.bubble.io/u/gerbertdelangen)\
**Post date:** [June 24, 2022, 6:22pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/3 "2022-06-24T18:22:11Z")

</div>

Hey @ryan19,

TinyPNG provides API’s to compress and resize images. Maybe you can use one of these options:

1. There is a [free plugin](https://bubble.io/plugin/tinypng---compress-images-1644701992307x308267524795924500) which can compress images. Maybe Olivier Coolen who created this plugin is willing to add the option to resize images.
2. It is possible to see the plugin code for the plugin above (see the link), so using that as an example together with the [documentation for the TinyPNG API](https://tinypng.com/developers/reference#resizing-images) you might be able to add the the resize option to your app using Bubble’s API connector plugin.
3. There is a [paid plugin](https://bubble.io/plugin/tinypng-compressresize-image-s3-1632995230717x431843340866813950) for TinyPNG which already has the option to resize images.

[N8N.io](https://n8n.io) (does automation like Zapier and Make) als provides the option to resize images. Since a couple of weeks/months they have a [desktop version](https://n8n.io/get-started/) so you can easily play around with it.

---

<div class="post-metadata">

**Author:** ![GH5T](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gh5t/32/209141_2.png) [@GH5T](https://forum.bubble.io/u/GH5T)\
**Post date:** [June 24, 2022, 6:38pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/4 "2022-06-24T18:38:07Z")

</div>

I have a plugin where you can convert 1500 compressions for free (with their API).

[Plugin Page](https://bubble.io/plugin/convertapi-max-1653096563316x340772155918909440) | [Plugin Demo](https://ghostcodes.bubbleapps.io/version-test/convert-api-max)

---

<div class="post-metadata">

**Author:** ![ryan18](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ryan18/32/125777_2.png) [@ryan18](https://forum.bubble.io/u/ryan18)\
**Post date:** [June 24, 2022, 9:46pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/5 "2022-06-24T21:46:27Z")

</div>

Great; thanks for the suggestions @cmarchan@gerbertdelangen @GH5T

This might sound basic but how do I go about looping/iterating over each user in a backend workflow?

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [June 24, 2022, 10:29pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/6 "2022-06-24T22:29:08Z")

</div>

Hello @ryan18

This post is about a different context but focus on the logic of the loop (recursive backend workflow): 😃

> [@Create a new account number via API workflows](http://forum.bubble.io/t/create-a-new-account-number-via-api-workflows/136285/2):
>
> Hello! When you send a list to have something done … that same “something” happens to each item of the entire list. This is why all your proveedores are getting the same “count+1”. If you want something different done to each proveedor, then you need to build logic for this different “something” to happen to each single entry. I suggest you consider using schedule api and not schedule api on a list and set everything up in a somewhat similar fashion to this: [image]

---

<div class="post-metadata">

**Author:** ![GH5T](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gh5t/32/209141_2.png) [@GH5T](https://forum.bubble.io/u/GH5T)\
**Post date:** [June 25, 2022, 1:59am UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/7 "2022-06-25T01:59:24Z")

</div>

Hey @ryan18 , simple answer:

**Create a backend workflow that deletes/updates/modifies**

**Set a parameter to the thing you’re trying to modify.**

**Setup your actions.**

**Create a scheduled API workflow ON A LIST.**

**When you configure that API Action, use Current Group or Current Cells, or Do a Search for you thing.**

Should do the trick.

---

<div class="post-metadata">

**Author:** ![ezduriez](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ezduriez/32/137886_2.png) [@ezduriez](https://forum.bubble.io/u/ezduriez)\
**Post date:** [August 16, 2022, 9:42pm UTC](https://forum.bubble.io/t/bulk-resize-images-in-db/212731/8 "2022-08-16T21:42:04Z")

</div>

I use Croppie plugin. You can setup the maximum file size in bytes or compress when save which is not higher than 250Kb (usualy is 100kb to 150kb) a picture from mobile. You can show a popup when the image is too large as well.
