Jump to content
Sign in to follow this  
Frogger34

Image Zoom with xml generator and Flash player

Recommended Posts

Hi all

 

I became intrested in the Yofla Multi Image zoomer which can be found at the same site ( .com ), i would like to build this one out to the product_info page so visitors can zoom in on the products.

 

It would be a nice contribution for us all, i have tested it with the OS version, and with the Contri automatic image shrink, so i have a small and a big image.

 

The problem i ran into is to compile the temp. xml file which tells the flash to display the large image and then after showing deleting the temp. xml file, it also has to do something with a session id, so if a xml file is ceated it is linked to the session from the visitor.

 

If any intrested ... we could make this new contri get to work together,

 

 

If anyone has this already working i think we all want to know how

 

Greetz

 

Frogger 34

Edited by Frogger34

Share this post


Link to post
Share on other sites

Hi,

 

I am currently working on this. So far I can write a temporary XML file, write most infos in there except the correct picture path and filename...

 

I also embedded the Yofla player in the popup_image.php

 

so the only thing which needs to be done is get the product ID and possibly the subimages ID (if someone uses a contrib like MorePics) and write this information in the XML file which is generated ....

 

 

check out the code:

 

first get the product IDs from the DB:

 

 require('includes/application_top.php');

 $navigation->remove_current_page();

 $products_query = tep_db_query("select pd.products_name, p.products_image from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);
// BOF: More Pics 6
$PID = $HTTP_GET_VARS['pID'];
$invis = $HTTP_GET_VARS['invis'];
$result = mysql_query("select * from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");
// EOF: More Pics 6

 

 

this is from MorePics (checks if more pics have been uploaded):

 

$image = tep_db_fetch_array($result);
if ($image['products_subimage6'] != ''){	   
$last = '6';
}elseif ($image['products_subimage5'] != ''){
$last = '5';
}elseif ($image['products_subimage4'] != ''){
$last = '4';
}elseif ($image['products_subimage3'] != ''){	   
$last = '3';
}elseif ($image['products_subimage2'] != ''){	   
$last = '2';
}elseif ($image['products_subimage1'] != ''){	   
$last = '1';
}elseif ($image['products_image'] != ''){	   
$last = '0';
}
$next = $invis + '1';
$back = $invis - '1';
?>
<?php
if (($invis == '0') || ($invis == '')){
$insert = $image['products_image'];
} else  {
$insert = $image['products_subimage' . $invis. ''];
}

$img = DIR_WS_IMAGES . $insert;

 

 

 

Create XML:

 

function savefile($xmldata, $filename){
  $directory = "../shop/images/";


if(isset($directory)){

	$directory = "../shop/images/";;
	//$directory = DIR_WS_IMAGES .'/';;
  }
	$filename_dir  = $directory . $filename;
	//$filename_dir  = DIR_FS_CATALOG . $directory . $filename;
	if ($fp = fopen($filename_dir, 'w+')){
			  fwrite($fp, $xmldata);
			  fclose($fp);
			  return true;
	}
	else  return false;
 }




function build_xml($data){		
$xmlfile='<?xml version="1.0" encoding="'.CHARSET.'"?>'."\n";
$xmlfile.="<config>\n";
	$xmlfile.="<settings>\n";
		$xmlfile.="<application>\n";
			$xmlfile.="<zoomSteps>5</zoomSteps>\n";
				$xmlfile.="<preloadImages>false</preloadImages>\n";
		$xmlfile.="</application>\n";
	$xmlfile.="<navigator>\n";
		$xmlfile.="<width>100</width>\n";
		$xmlfile.="<height>67</height>\n";
	$xmlfile.="</navigator>\n";
	$xmlfile.="</settings>\n";

		$xmlfile.="<images>\n";
		$xmlfile.="<image>\n";

			$xmlfile.="<thumb>";
			$xmlfile.=CHARSET;
			$xmlfile.="</thumb>\n";


			$xmlfile.="<large>\n";

			$xmlfile.=tep_href_link('popup_image.php','pID='.$PID.'&invis='.$back);
			//$xmlfile.=DIR_WS_CATALOG . DIR_WS_IMAGES . $product_image['products_image'];
			//$xmlfile.=DIR_FS_CATALOG_IMAGES . $product_image['products_image'];
			$xmlfile.="</large>\n";


		$xmlfile.="</image>\n";


		$xmlfile.="<image>\n";

			$xmlfile.="<thumb>\n";
			$xmlfile.=tep_image(DIR_WS_IMAGES . $insert);
			$xmlfile.="</thumb>\n";


			$xmlfile.="<large>\n";
			$xmlfile.=DIR_WS_IMAGES . $products['products_image'];
			$xmlfile.="</large>\n";

		$xmlfile.="</image>\n";

		$xmlfile.="	</images>\n";

$xmlfile.="</config>\n"; 

savefile($xmlfile, 'config.xml');
 }

 build_xml($xmlfile);

 

 

 

 

be sure to have correct write permissions to the folders and files...

 

So far this writes me a XML file but still I need to let the XML know the current product picture...

 

If anyone knows how to to this please let us know

 

this here:

 

$xmlfile.="<large>\n";
$xmlfile.=DIR_WS_IMAGES . $products['products_image'];
$xmlfile.="</large>\n";

 

doesn't work ....

Share this post


Link to post
Share on other sites
$xmlfile.="<large>\n";
$xmlfile.=DIR_WS_IMAGES . $products['products_image'];
$xmlfile.="</large>\n";

Do thumbs work? The equivalent of your thumb code would be
$xmlfile.="<large>\n";
$xmlfile.=tep_image(DIR_WS_IMAGES . $products['products_image']);
$xmlfile.="</large>\n";

If that doesn't work, can you make the XML manually and give an example of how you want it to come out?


Always back up before making changes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×