Extensis Logo SUPPORT | FORUMS | KNOWLEDGE BASE

Portfolio API Code Samples


#1

The Portfolio API documentation comes with several code samples that illustrate the different methods available through the API. But sometimes seeing these samples out of context isn’t enough. You need to see the whole application that they came from.

Attached to this message is a zip file containing the PHP code that was used to create the code samples. These are not complicated scripts. They were written to demonstrate specific methods, but they are functional.

Instructions for using the PHP Code Samples.

[ul]1. Download and unzip the attached file.
2. Open Terminal on Macintosh or the Command Line utility in Windows.
3. Navigate to the folder containing the PHP source files.
4. Run one of the files using the following command. (For example: loginLogout.php)
php LoginLogout.php[/ul]

You will need to make some modifications to the scripts to get them to work on your system. Open the files in a text editor and change the ‘$SERVER_ADDRESS’ variable so that it is pointing to your Portfolio Server. The ‘$catUsed’ variable references a specific catalog the script interacts with. Change this to one of your own catalogs, or create one called simple.fdb.

Please post any questions you might have to the forums and we’ll answer them as best we can.

For the very latest updates to the API documentation and new code samples, you can view the online API code reference at doc.extensis.com/api/portfolio/index.html.

-Matt
PHP Code Samples.zip (178 KB)


#2

Hi Matt,

I am aware that the PHP code able to call the media script auto script. However, are you able to confirm whether php api code able replace the following automated process which we currently implement it at one of our client site:

  1. Obtain the embedded value of DC:description/caption; and
  2. color correct the asset; and
  3. Scale the asset; and
  4. name the output file as per value of the metadata in process 1; and
  5. upload the assets to the ftp server.

On another matter, this probably a bit outside the topic. Would the custom php able to integrate with wordpress. If yes, It would be great if there is example of this available.

Looking forward to your response.

Regards,

Alex


#3

[quote]I am aware that the PHP code able to call the media script auto script. However, are you able to confirm whether php api code able replace the following automated process which we currently implement it at one of our client site:

  1. Obtain the embedded value of DC:description/caption; and[/quote]
    The Portfolio API can access the Description for the record in the Portfolio Database. When the image was cataloged, the description should be extracted and added to the database. If this is the case, the API should be able to access it.

Can you provide me with more information on what you mean by color correct? What sort of color corrections are you applying?

[quote]3. Scale the asset; and
4. name the output file as per value of the metadata in process 1; and[/quote]
An example of resizing and renaming a file can be found here: PHP Jobs and Tasks..
Choosing the name to apply to the file is just text manipulation, which you should be able to do within your PHP code.

The final results of the API Job is stored on an HTML location on the portfolio web server. You can have your code download the file and then upload it to your FTP server. This would be limited by your ability to program in PHP.

There is not currently an example of Wordpress integration for the API. If one was developed, what would you like see?

If you have anymore questions, please let me know.

-Matt


#4

CMYK to RGB

Sample of integration with wordpress.

Other matter:

I have followed the instruction on the getting started but I have no success run. When I run the getting started script, it returns with the following error [color=#FF0000]Parsing WSDL: Couldn’t load from ‘AssetService.wsdl’ : failed to load external entity “AssetService.wsdl”[/color]

I have downloaded the wsdl library and I have put it in the PHP working directory. I think I have done it incorrectly. Please advise.

Thank you.


#5

CMYK to RGB
[/quote]
In the Code Sample for Jobs and Tasks, there is an example for converting a file. One of the options when converting is the ColorMode that you would like to have specified.

$convertTask = new Task(); $convertTask->type = TaskType::CONVERT; $convertSettings = array( 0 => buildAtt(TaskSetting::OUTPUT_FILE_FORMAT, OutputFileFormat::JPEG), //When setting the Color_Mode, specify CMYK, RGB, or GRAYSCALE. 1 => buildAtt(TaskSetting::COLOR_MODE, ColorMode::RGB), 2 => buildAtt(TaskSetting::RESIZE_TYPE, ResizeType::FIT_WITHIN), 3 => buildAtt(TaskSetting::RESIZE_HEIGHT, "512"), 4 => buildAtt(TaskSetting::RESIZE_WIDTH, "256"), 5 => buildAtt(TaskSetting::RESIZE_UNITS, Unit::PIXELS) ); $convertTask->settings = $convertSettings;
Please not that not all these options are required. Just the ones that you need.

Sample of integration with wordpress.
[/quote]
We’ll see what we can do.

[quote=“vertu”]Other matter:

I have followed the instruction on the getting started but I have no success run. When I run the getting started script, it returns with the following error [color=#FF0000]Parsing WSDL: Couldn’t load from ‘AssetService.wsdl’ : failed to load external entity “AssetService.wsdl”[/color]

I have downloaded the wsdl library and I have put it in the PHP working directory. I think I have done it incorrectly. Please advise.

Thank you.[/quote]

Open up GettingStarted.php in your favorite text editor and replace

$service = new AssetSEIService(); $service->SoapClient("http://$SERVER_ADDRESS:$SERVER_PORT/ws/1.0/AssetService?wsdl", array());
with

and try to run the code again. If it is still not working, please let me know.

-Matt


#6

Thank you Mark, that’s work.