question

1982ba avatar image
1 Like"
1982ba asked

How do I get large item photos?

 

How do I get a large item image using the eBay API? The API call below returns a thumbnail image when I use galleryURL. I tried replacing it with PictureURLLarge, but that did not return a URL.

(The line I am referring to is 16th from the bottom: $pic = $item->galleryURL;)

 

 


// API request variables
$endpoint = 'http://svcs.ebay.com/services/search/FindingService/v1'; // URL to call
$version = '1.11.0'; // API version supported by your application
$appid = 'XXXXX'; // Replace with your own AppID
$globalid = 'EBAY-US'; // Global ID of the eBay site you want to search (e.g., EBAY-DE)
$query = "soft thin (shirt, tshirt, t-shirt)"; // Supply your own query
$safequery = urlencode($query); // Make the query URL-friendly
$i = '0'; // Initialize the item filter index to 0

// Create a PHP array of the item filters you want to use in your request
$filterarray =
array(
array(
'name' => 'MaxPrice',
'value' => '1500',
'paramName' => 'Currency',
'paramValue' => 'USD'),
array(
'name' => 'FreeShippingOnly',
'value' => 'false',
'paramName' => '',
'paramValue' => ''),
array(
'name' => 'ListingType',
'value' => array('AuctionWithBIN','FixedPrice','StoreInventory'),
'paramName' => '',
'paramValue' => ''),
);

// Generates an indexed URL snippet from the array of item filters
function buildURLArray ($filterarray) {
global $urlfilter;
global $i;
// Iterate through each filter in the array
foreach($filterarray as $itemfilter) {
// Iterate through each key in the filter
foreach ($itemfilter as $key =>$value) {
if(is_array($value)) {
foreach($value as $j => $content) { // Index the key for each value
$urlfilter .= "&itemFilter($i).$key($j)=$content";
}
}
else {
if($value != "") {
$urlfilter .= "&itemFilter($i).$key=$value";
}
}
}
$i++;
}
return "$urlfilter";
} // End of buildURLArray function

// Build the indexed item filter URL snippet
buildURLArray($filterarray);

// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsAdvanced";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&descriptionSearch=true";
$apicall .= "&categoryId=110";
$apicall .= "&keywords=$safequery";
$apicall .= "&paginationInput.entriesPerPage=100";
$apicall .= "$urlfilter";

// Load the call and capture the document returned by eBay API
$resp = simplexml_load_file($apicall);

// Check to see if the request was successful, else print an error
if ($resp->ack == "Success") {
$results = '';
// If the response was loaded, parse it and build links
foreach($resp->searchResult->item as $item) {
$pic = $item->galleryURL;
$link = $item->viewItemURL;
$title = $item->title;
$ship = (float) $item->shippingInfo->shippingServiceCost;
$price = (float) $item->sellingStatus->currentPrice;
$sell = ($ship + $price);

// For each SearchResultItem node, build a link and append it to $results
$results .= "<a href=\"$link\" title=\"$title\" target=\"_blank\"><div class=\"shirt-block\"><img src=\"$pic\" width=\"200\" height=\"200\"><br /><br /><span class=\"cost\">$$sell</span></div></a>";
}
}
// If the response does not indicate 'Success,' print an error
else {
$results = "<h3>Oops! The request was not successful. Make sure you are using a valid ";
$results .= "AppID for the Production environment.</h3>";
}
finditemsadvancedpictures
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

$$anonymous$$ avatar image
0 Likes"
$$anonymous$$ Suspended answered

use outputSelector

 

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

epinapala avatar image
0 Likes"
epinapala answered

Hi,

 

Codechanges: In color shade!
 

             $outputSelector = 'PictureURLSuperSize';

 


// Construct the findItemsByKeywords HTTP GET call
$apicall = "$endpoint?";
$apicall .= "OPERATION-NAME=findItemsAdvanced";
$apicall .= "&SERVICE-VERSION=$version";
$apicall .= "&SECURITY-APPNAME=$appid";
$apicall .= "&GLOBAL-ID=$globalid";
$apicall .= "&descriptionSearch=true";
$apicall .= "&categoryId=110";
$apicall .= "&keywords=$safequery";
$apicall .= "&outputSelector=$outputSelector";

$apicall .= "&paginationInput.entriesPerPage=100";
$apicall .= "$urlfilter";

 

 

 

Documentation:

 

Including additional data in the response—Specify one or more outputSelector fields to retrieve more than the default set of response data. For example, you can retrieve seller information for each item, or an aspect histogram.

 

Defines what data to return, in addition to the default set of data, in a response. 

If you don't specify this field, eBay returns a default set of item fields. Use outputSelector to include more information in the response. The additional data is grouped into discrete nodes. You can specify multiple nodes by including this field multiple times, as needed, in the request. 

If you specify this field, the additional fields returned can affect the call's response time (performance), including in the case with feedback data. 

Applicable values:

•   AspectHistogram

(in) Include an AspectHistogram container with information about aspects from the domain that is most relevant to your search.

•   CategoryHistogram

(in) Include a CategoryHistogram container with information about categories that match your search.

•   ConditionHistogram

(in) Include a ConditionHistogram container with the number of items found per condition (e.g., how many items are new). This value has no effect when Condition is specified as an item filter. Supported for all eBay sites except US eBay Motors, India (IN), Malaysia (MY) and Philippines (PH).

•   GalleryInfo

(in) Include the GalleryInfoContainer, which contains URLs for three thumbnail images of the item in different sizes: large, medium, and small.

•   PictureURLLarge

(in) Include a URL to a picture of the item that is 400x400 pixels in size.

•   PictureURLSuperSize

(in) Include a URL to a picture of the item that is 800x800 pixels in size.

•   SellerInfo

(in) Include information about the seller in the response.

•   StoreInfo

(in) Include information about the seller's eBay store in the response.

· 2
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hi Eswara, 

 

Thank you so much for your your help.  How do I call the larger picture in the results section? 

 

Carson

0 Likes 0 ·

You would use $item->pictureURLSuperSize, I think.  See Finding API docs for more info and nodes that can be returned.

0 Likes 0 ·
1982ba avatar image
0 Likes"
1982ba answered

I discovered the problem, and it is really stupid.  Setting the description search as "true" disables the ability to use the output selector that let's you get the pictureURLLarge  I don't know why...

 

If I set description search as false, i can get the pictureURLLarge. 

 

so dumb. 

· 2
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thanks for discovering this, Is there any other possibility to make description = true and also large image would come in the results array?

 

Looking forward to your response.

 

 

0 Likes 0 ·

Hey did you ever find this answer? It's very frustrating. I have been waiting to hear from ebay with no luck. I have the same issues. if False it works, if True I don't get anything back. 

0 Likes 0 ·
devanathan.developersupport@ebay.com avatar image
0 Likes"
devanathan.developersupport@ebay.com answered

Currently we were aware and working on this issue at the moment.
We'll update this thread as soon as there is any development on the matter.

Best Regards,
eBay Developer Support

· 1
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello. It has been 2.5 years since you said you were working on this issue. Any update?
0 Likes 0 ·
harut1984 avatar image
0 Likes"
harut1984 answered
Hey guys, I get a quite strange problem related to item image. I am trying to find items by category, and successfully getting the result in the xml format. BUT for some items the **"galleryURL" (item picture url)** redirects to **'No Image'**, but actually item has an image in the ebay (I checked that by opening its url in ebay). So what is this, a **bug in the API**? Here is the rest service url I used (please check and you will see what I mean): http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByCategory&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=XXX&RESPONSE-DATA-FORMAT=XML&paginationInput.pageNumber=1&paginationInput.entriesPerPage=2&outputSelector=GalleryInfo&REST-PAYLOAD&categoryId=97042 This actually returns 2 items, and the picture url of the first item opens a **"No Image" picture**, here is it: http://thumbs1.ebaystatic.com/pict/04040_0.jpg But actually an item has images in the ebay, you can see it by following url: http://www.ebay.com/itm/RDX-Leather-Gel-Tech-Training-MMA-UFC-Grappling-Gloves-Fight-Sparring-Punch-Bag-/281799902653?var=0 And also one more strange thing: both items in the returned xml response **refer to the same item in the ebay** - so they both have the same itemId=281799902653. When I open ebay urls for both of them - the second item openes the same page as item1, but the "Color" is selected as "Black" :) So I am kindly asking you to help me in this. Is this an API issue? And do you have any approach on this (the main problem that I am trying to find a solution, is that galleryUrl of the item is a 'No Image' icon - so I have very bad looking view in my web site)? Thanks in advance! Harut
· 1
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

'HideDuplicateItems' solves everything...
0 Likes 0 ·
asisaliml0 avatar image
0 Likes"
asisaliml0 answered
Hi! I got the same exact problem. Have anyone found solution yet?
10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tincomet avatar image
0 Likes"
tincomet answered

For all the other newbies like me....

Put this in your URL

&outputSelector=PictureURLLarge

and do this to display it

$pic = $item->pictureURLLarge;

Having descriptionSearch set to true doesn't seem to be a problem, was probably fixed since this thread was posted. Anyway, have fun with the bigger pictures!

10 |600 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.