Location: PHPKode > projects > TVEz - Media Library > tvez-0.2.1/html/admin/amazon_lib.php
<?php

# ------------------------------------------------------------------------------
#
# Contains all the php Amazon image functionality
#
# ------------------------------------------------------------------------------
#
# Copyright (C) 2003 Christian Eheim and Alex Pachikov
#
# This file is part of TVEz (tvez.sourceforge.net).
#
# TVEz is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# TVEz is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with TVEz; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# ------------------------------------------------------------------------------
#
# Created on 01/04/2004 by Christian Eheim (hide@address.com)
#
# LAST MODIFIED:
# $Date: 2004/01/11 23:20:46 $
# $Revision: 1.1.1.1 $
# $Author: eheim $
#
# ------------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# Get the amazon links on the fetured page
# -----------------------------------------------------------------------------
function get_amazon_imgs($linkName) {
	global $IMDB_HTTP;
	# If there is no redirect on amazon, the image is not there
	# and we can give up now
	# Otherwise, grab all the links
	$headers = http_headers($IMDB_HTTP,80,5,$linkName);
	
	if ( preg_match("/\/ASIN\/([^\/]*)\//", $headers['Location'], $aid) ) {
		$amazonID = $aid[1];
	}
	elseif ( preg_match("/keyword=([^\%]*)/", $headers['Location'], $aid) ) {
		$amazonID = $aid[1];
	}
	else
		return array(NULL,NULL);
	
	$large = "http://images.amazon.com/images/P/$amazonID.01.LZZZZZZZ.jpg";
	$medium = "http://images.amazon.com/images/P/$amazonID.01.MZZZZZZZ.jpg";

	return array($medium,$large);
}

?>
Return current item: TVEz - Media Library