Search code examples
transloadit

Use flow logic to skip a step in Transloadit assembly?


Is it possible to use the flow logic or file filtering in Transloadit to convert a PNG to a JPG if the uploaded file is not already a JPG, but skip the step and continue with the other processing steps otherwise?

From what I can see from the docs, you can only halt an assembly if a condition is or isnt met..

Thanks!


Solution

  • You can use the /file/filter robot to pass :original files only to an /image/resize step if it matches your conditions.

    You should disable error_on_decline to make this filtering seamless.

    Here's more information on the /file/filter robot and here are all the variables you can use to filter by.

    Looks like you could use either ${file.ext} or maybe ${file.mime}

    Hope this helps!