Image size in response

Options
I want to have response  image array with "?tpl=med" included in URL
Im using Draftbit as FE & I havent found how to change it on FE so would be nice to have it from Xano side.
[Screenshot 2022-01-04 at 09.14.59.png]
Can you please suggest how to add this to endpoint. Thank you.

Comments

  • Karl Larson
    Options
    I use concatenate to add the "?tpl=med" to a URL. Here's an example that also has "box" and turns the image into a .jpg.
    [CleanShot 2022-01-04 at 10.00.45@2x.jpg]
  • Anna Sho
    Anna Sho Member
    Options
     Thanx! One more question. how do you update that variable ? can you share screenshot? I need to figure out what to do here
    [Screenshot 2022-01-04 at 19.28.51.png]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - what you have is an object array (list), nested inside an object array.

    Almost anytime you are dealing with arrays/list and want to manipulate or transform them, you must loop through them...

    In this case, I would do a 

    For Each Loop 
    var: products.photo as item

    Update variable 
    item.url
    concat filter - the tpl argument you want to use. 
  • Anna Sho
    Anna Sho Member
    Options
     thank you. Ive tried but looks like there should be different solution because I have array of photos for each product, and now it returns photos array separately not for each product. Can you suggest how to do loop inside the loop? I tried and it didt work..
    [Screenshot 2022-01-05 at 07.57.41.png][Screenshot 2022-01-05 at 07.57.50.png][Screenshot 2022-01-05 at 07.57.29.png]
  • Anna Sho
    Anna Sho Member
    Options
     can you help with this? I have Object Array variable and I cannot manipulate with lower node...
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     - you actually need two loops because you have two lists:

    
  • Anna Sho
    Anna Sho Member
    Options
     Thank you very much for detailed explanation!! And  I've finally figured out problem - I have external paging for all of my lists and such loop example is not working for that paging option.

    So I've added to products_1 table that you've cloned and it stops working wen added paging and works when I turn it down.

    🙏 last question from me on this topic: what to add to your example so loop will go through items &  will skip pagination  ??
    [Screenshot 2022-01-07 at 22.11.53.png]
    [Screenshot 2022-01-07 at 22.09.59.png]
    And huge thanx  to you for paying attention to my questions.
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     Your path changes now that you've added paging - notice how your results are now nested in the items array? That must be added accordingly to your paths now.

    I'm not sure I understand what you mean by skip paging.

    Maybe this example will help you

    
  • Anna Sho
    Anna Sho Member
    Options
    

    your code was working untill Ive just turned on Paging and I see list of metadata in response.

    [Screenshot 2022-01-07 at 22.53.36.png]
    [Screenshot 2022-01-07 at 22.54.54.png]
    and when I debug I get error:
    [Screenshot 2022-01-07 at 22.11.53.png]
  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
     once again, because now your data has a different path... without paging you had a raw response, now your data is nested in the items array... you need to adjust the paths in the logic accordingly to reflect this