Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image Zoom with xml generator and Flash player


Frogger34

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
Link to comment
Share on other sites

  • 3 months later...

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

Link to comment
Share on other sites

  • 5 months later...
$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.

Link to comment
Share on other sites

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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