3 messages in com.googlegroups.google-base-data-apire: Media Feed Images| From | Sent On | Attachments |
|---|---|---|
| sparrowhawk | 18 Mar 2008 11:43 | |
| sparrowhawk | 19 Mar 2008 08:14 | |
| Jeff S | 19 Mar 2008 10:41 |
| Subject: | re: Media Feed Images![]() |
|---|---|
| From: | sparrowhawk (cont...@ajmoss.com) |
| Date: | 03/18/2008 11:43:51 AM |
| List: | com.googlegroups.google-base-data-api |
Hello. I have managed to configure Zend Platform w/ GData and use the api to add some items to our account.
I have uploaded images using the media feed as I couldn't get the image_link attribute to work correctly. This works great and uploads the images right away which is key!
My Question: When I look at my items on Base it shows an image next to the images that have a media feed image, but when I go to edit the products in the Base Online User Interface there is a link that says, "Make this the main image".
Do I need to be doing something special for Google to know that this is the main image for that item? Will these products be eligible to show up in Google Products?
BTW -- This is the method I'm using to upload the media images at the same time as adding the item. $image_link is the absolute path to the image on our server:
function addItem($client,$title='',$description='',$link='', $image_link='',$id='',$price='',$brand='',$upc='',$manufacturer='', $apparel_type='',$delivery_notes='',$product_type='',$model_number='', $condition='') {
$service = new Zend_Gdata_Gbase($client);
$newEntry = $service->newItemEntry();
$newEntry->title = $service->newTitle(trim($title));
// Add some content $content = $description; $newEntry->content = $service->newContent($content); $newEntry->content->type = 'text';
//add the main link $linkArray = $newEntry->link; $linkArray[] = $service->newLink( $link, 'alternate', 'text/html'); $newEntry->link = $linkArray;
// Define product type $itemType = "Products"; $newEntry->itemType = $itemType;
// Add item specific attributes $newEntry->addGbaseAttribute("link", $link, "text"); //$newEntry->addGbaseAttribute('image_link', $image_link); $newEntry->addGbaseAttribute("mpn", $id, "text"); $newEntry->addGbaseAttribute("price", $price . " USD", "floatUnit"); $newEntry->addGbaseAttribute("brand", $brand, "text"); $newEntry->addGbaseAttribute("upc", $upc, "text"); $newEntry->addGbaseAttribute("manufacturer", $manufacturer, "text"); $newEntry->addGbaseAttribute("apparel_type", $apparel_type, "text"); $newEntry->addGbaseAttribute("delivery_notes", $delivery_notes, "text"); $newEntry->addGbaseAttribute("product_type", $product_type, "text"); $newEntry->addGbaseAttribute("model_number", $model_number, "text"); $newEntry->addGbaseAttribute("condition", $condition, "text"); $newEntry->addGbaseAttribute('payment_notes', 'Google Checkout', 'text');
$dryRun = false; $createdEntry = $service->insertGbaseItem($newEntry, $dryRun);
$itemUrl = $createdEntry->id->text;
//add the image $extEls = $createdEntry->getExtensionElements(); $mediaLinkHref = null; foreach ($extEls as $extEl) { if ($extEl->rootElement == 'feedLink') {
// this is a feedLink element $extAtts = $extEl->getExtensionAttributes(); if ($extAtts['rel']['value'] == 'media') { $mediaLinkHref = $extAtts['href']['value']; } } } if ($mediaLinkHref != null) { echo "we have a media link href\n"; echo "let's upload an image\n"; $mediaFileSource = $service->newMediaFileSource($image_link); $mediaFileSource->setContentType('image/png'); try { $service->post($mediaFileSource, $mediaLinkHref); } catch (Zend_Gdata_App_Exception $e) { var_dump($e); } }
return $itemUrl; }




