Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

How to use PHP to transfer Catalog images


#1

Hi

I am currently trying to do something similar to this http://labs.extensis.com/viewtopic.php?f=11&t=265 in PHP and want to know how do I set limits to the job as I’m trying to test as the current catalog i’ll be using has over 1000 images.

I will be using this functionality to automate the transfer of cataloged images in portfolio to external folders.

Any PHP examples will be appreciated. Or even a much simpler method using the API.

Thanks


#2

Hi Trey,

Jobs are limited by the query that is used to create them. So if you just wanted to test on a handful of assets, you could make a query for just those assets (and specify them by id, or name, or whatever field you want), and give that query to a new Job. You could also limit the Job to the contents of a gallery, folder, etc. by making a query for that.

We have PHP examples of running Jobs here:
doc.extensis.com/api/portfolio/C … s.html#PHP

and some PHP examples of building Queries here:
doc.extensis.com/api/portfolio/C … s.html#PHP

If you give me a better idea of exactly what you hope to accomplish, I can provide more details about how to configure your Job. It sounds like you want to copy or move assets to external folders. Do you want to copy/move the original files, or derivatives of them? Any other details you can provide will help us give better examples.

Thanks,
-Loren


#3

Thanks Loren.

I have looked at those examples and got some issues.
after running my job when i take a look at the object returned says /FileTransfer/download?jobId=null where it should say the jobId because it is also contained in the object. I got to here http://doc.extensis.com/api/portfolio/CodeSamples/DownloadJobs.html#php and now I’m stuck with not being able to get the download file

What I’m trying to accomplish… Is that i want to pull all original images from selected catalogs in the system and move them to a folder on another external server to be Batch processed to convert into jp2 format and possibly smaller file sizes. This is so that they can be used in Web and Mobile apps. The reason I have to do it this way, is that our system sits behind a firewall thats not for public access.

I’m hoping to use the API and some PHP to automate a process of getting the images out.

Thanks


#4

Hi Trey,

Brooks here.

A few questions:

What version of the Portfolio server are you working with?
Are you using the SOAP API or the REST API?
How are you planning to convert to jp2 - just checking because, unfortunately, Portfolio doesn’t currently do that.
Why don’t you simply copy the files to the remote location? Is it because they are scattered?

My suggestion is to

  1. Use a query to page through all assets using a sensible page size of, say, 100.
  2. For each page, each asset, use the GET REST method

/catalog/{catalog_id}/asset/{asset_id}/_original?session={session}

and save the content to wherever you like.

For testing, you can simply stop at however many assets you decide. In your query, you may want to ask for the filenames in order to save the content.

As for the job_id=null issue, I think that’s a bug, and our client just knows the url and sends job_id={the_actual_job_id}. However, I don’t recommend making a giant archive of all the originals because it would be very unwieldy.

Best regards


#5

Hi Brooke,

I’m one of the team members working on this project with Trey

-Portfolio - Version 2.0.0 (20151028-63670ff)
-We’re using SOAP API
-We’re currently building a museum collection online project, we’re using ImageMagick to handle the image conversion. Imagemagick is setup on AWS EC2 we’re using AWS Batch (aws.amazon.com/batch/) to automate the .jp2 conversion when the new files are dump into the server and Batch pushes the jp2 to our image server so the images can be published online. But we just need to sort out how to pull the tiff out of Portfolio first. At the moment, we’re manually pulling the images out of Portfolio and pushing it to AWS. Its painstaking process because some of our images get updated over tme ie new images is updated etc so we need online collection to reflect these changes.

It would be nice if Portfolio can support jp2 exports so we don’t have to do all this :slight_smile:


#6

Hi Trey’s team member,

Thanks for the information and for explaining more about what you’re trying to to. Funny, we use ImageMagick inside of our media engine, but jp2 hasn’t been a priority as a destination format although we are hearing about it more. It’s also well supported by our sister company, LizardTech, for geo applications. My guess is that we will have better support for it in the future.

The REST endpoint I mentioned is available in version 2.0 (although I definitely recommend updating to the latest, 2.5.3). The SOAP and REST server interfaces are straightforward to combine - you can supply the same authentication token to both. If you are already querying for a list of assets using the SOAP API, you can continue to do that, and use the REST endpoint I mentioned previously to get the content and push it to AWS Batch. I am not a PHP programmer, but I am sure that PHP has a decent HTTP library that you can use to make REST calls.

Please let me know how this works out and whether I can give you any other information.

Best regards, Brooks