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!!!!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.