Jump to content

How can i resize an image pulled from an API


ydoisuck

Recommended Posts

Hi, I'm trying to resize an I'm from google product search, there's lots of code on the web but I don't know how to use it when i'm pulling an image from a json script.

 

the script structure can be seen here.http://www.rafoggin.com/Shrop/googletestapi.php

 

and my script to pull this info is:

//Google API		
$response = file_get_contents("https://www.googleapis.com/shopping/search/v1/public/products?key=AIzaSyDCrZzoEB46bliROIn8JgOImm0B5YvxbVY&country=US&q=$upc"); 
$object = json_decode($response); 

echo '<p class="green"> success </p>';
echo '<p> Found on <b>Google Shopping</b></p>';

foreach($object->items as $item) {

foreach($item->product->images as $image) {
	echo '<img src="'.$image->link.'" />';

}

echo '<br/><p><b>Title: </b>'.$item->product->title.'</p>';
echo '<p class="barcode"> GTIN Code: '.$item->product->gtin.'</p><br/>';

foreach($item->product->inventories as $inventory) {
	echo '<p class="price">Price: '.$inventory->price.' '.$inventory->currency.'</p><br/>';
}

echo '<p><b>Description: </b>'.$item->product->description.'</p>';
//echo '<p>Link:'.$item->product->link.'</p>';

echo '<hr/>';

 

Please help me!!!!

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.