Third Light Developer Exchange

Code and templating community forum for developers and software integrators

You are not logged in.

Announcement

If you wish to join the Developer Exchange, please contact your account manager - this is to avoid unnecessary spam in the forums. Many thanks for your understanding.

#1 2015-03-26 18:28:31

JuicePaul
Member
Registered: 2015-03-25
Posts: 7

Getting Download Links for Multiple Assets at Once

Scenario:

  • Search through available assets using keywords.

  • Return relevant assets along with a permanent link to the latest revision in both high res PDF and low res PNG.

As far as I can see, I cannot get download links to the assets that are returned from the search in one go.
I must loop through the assets, one by one sending them off to the "Downloads_GetLink" for the low res, and again for the high res.

Is it not possible to get download links for an array/hash of asset IDs all at once?

For example:

$search_return = array('123', '456', '789');
$args = array('assetId' => $search_return, 'settings' => array('format' => 'JPG', 'rev' => 'CURRENT', 'permanent' => true));
Send to Downloads_GetLink

Would result in all 3 images returning a maximum res JPG URL of the current revision.
And then sending them off again for the low res.

This would mean only 2 function calls instead of 6 as I currently have to do.
This exponentially slows down the script based on the amount of images returned from a search, which is extremely problematic.
For example, should there be 10 results, it currently has to make 20 calls to Downloads_GetLink, whereas if it accepted an array, it would still only make 2 calls.

Is there any other approach to this scenario that would be better than what I have got currently?

Thanks in advance.

Offline

#2 2015-06-02 11:50:16

ben
Third Light Staff
From: Third Light
Registered: 2013-06-06
Posts: 66

Re: Getting Download Links for Multiple Assets at Once

Hi,
Sorry that your question hasn't got a response until now.
At present there isn't a better way to do what you're doing. However, just to make sure of a few things:
1) do you absolutely need the PNG? would a JPG be OK?
2) are you aware (I don't think this is documented unfortunately) that the search call can accept a thumbsize option so you can request a thumbsize up to 1200x800 (but JPG only)
3) can the consumer of your data perform api calls - i.e. you could postpone the GetLink(original) call until you definitely need the original.
4) out of interest how long does it take for your IMS to respond to a GetLink() call? because they should be very quick, so although you are having to send many requests they shouldn't take all that long. I appreciate it's still not ideal but just checking that there isn't something wrong with the server that we could investigate further.

And lastly, we're looking internally at implementing the "multi version" of the GetLink call. It's not going to be a lot of work so we'll probably implement it fairly shortly. Unfortunately I can't give a more precise timescale right now.

Ben

Offline

#3 2015-06-03 14:20:47

JuicePaul
Member
Registered: 2015-03-25
Posts: 7

Re: Getting Download Links for Multiple Assets at Once

Hi Ben,

Thanks for the reply.

To answer your questions:

1. Yes, it must have transparency.
2. I think I may have been aware of this, I can't quite remember. But regardless, as above, PNG is required.
3. No, I'm afraid not.
4. It ranges between 0.15 to 0.225 seconds per call, which is already a little on the slow side. This quickly adds up, and a folder with 44 images in (thus 88 calls) takes anywhere between 12 and 20 seconds to fully process. Obviously, the more images, the worse it gets.

I'm glad you're looking at a multi version of the GetLink call as this is pretty crucial to one of our requirements of the DAM. It struck me as a potentially very easy implementation at your end, so thought it was worth bringing up.

Thanks again.

Offline

#4 2015-06-03 16:11:51

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 96

Re: Getting Download Links for Multiple Assets at Once

Hi Paul,

We have implemented the multi-version internally, although it is not yet released. This will accept an array of assetIds, and an equivalent settings hash (with the additional ability to override the settings per-file in sub-hashes).

Dominic

Offline

#5 2015-06-03 16:31:54

JuicePaul
Member
Registered: 2015-03-25
Posts: 7

Re: Getting Download Links for Multiple Assets at Once

Hi Dominic,

That sounds perfect! Thanks.

Offline

#6 2015-06-24 08:29:24

JuicePaul
Member
Registered: 2015-03-25
Posts: 7

Re: Getting Download Links for Multiple Assets at Once

Hi both,

Thanks for sorting this out. You'll be glad to know that it now means our script has gone from 0.5 seconds per image returned to 0.5 seconds no matter how many images.



Kind regards,

Paul

Offline

#7 2015-07-07 09:02:21

dominic
Third Light Staff
Registered: 2013-06-06
Posts: 96

Re: Getting Download Links for Multiple Assets at Once

Great to hear!

For the benefit of anyone else looking for this, Downloads.GetMultiLink is available from IMS v6.1.8-5 onwards.

Dominic

Offline

Board footer