jaysin Posted June 13, 2003 Posted June 13, 2003 I am trying to add this java script for my popup_image.php but not able to define var image path which is required to pull image from database. <?php /* $Id: popup_image.php,v 1.16 2003/02/13 03:10:56 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ 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 = '" . $HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . $languages_id . "'"); $products_values = tep_db_fetch_array($products_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <title><?php echo $products_values['products_name']; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <script language="javascript"><!-- var i=0; function resize() { if (navigator.appName == 'Netscape') i=40; if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i); self.focus(); } //----------------------------------------------------------------- var img_path="['<?php echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])); ?>]"; // The Image Path required like images/dvd/theres_something_about_mary.gif | var top_pos=150; // Image position from top | var left_pos=162; // Image position from left | var max_width=900; // Max allowable width | var min_width=10; // Min allowable width | var time_length=1; // Zoom delay in milliseconds | var step=2; // Pixels by which image should zoomm | //----------------------------------------------------------------- document.write('<div id="q_div" style="position:absolute; top:' + top_pos + '; left:' + left_pos + '"><img src="' + img_path + '" border="3" bordercolor="#000000" name="z" alt="zoOom"></div>'); img_act_width=z.width; img_act_height=z.height; var original_time=time_length; function zoom_out() { if(z.width==0) { z.border=0; } if(z.width!=0) { if(z.width>min_width) { z.width-=step; z.height=Math.round(z.width*((img_act_height)/(img_act_width))); setTimeout("zoom_out()",time_length); } else { window.alert('Width less than Minimum Widthn? Qiksearch zoOom.'); } } } function zoom_in() { if(z.width==0) { z.border=0; } if(z.width!=0) { if(z.width<max_width) { z.width+=step; z.height=Math.round(z.width*((img_act_height)/(img_act_width))); setTimeout("zoom_in()",time_length); } else { window.alert('Maximum Width exceededn? Qiksearch zoOom.'); } } } function resume_zoom() { time_length=original_time; } function pause_zoom() { time_length=10000000000; } function set_original() { z.width=img_act_width; z.height=img_act_height; } //--></script> </head> <body onload="resize();"> <?php //echo tep_image(DIR_WS_IMAGES . $products_values['products_image'], $products_values['products_name']); ?> <!--BEGIN ZOOM LINKS--> <table cellspacing="10" cellpadding="10" align="center"><tr> <td style="border:3 solid #000000" align="middle"><a href="#" onmouseover="javascript:resume_zoom();zoom_in();" onmouseout="javascript:pause_zoom();" style="font-family:verdana,arial,helvetica; font-weight:bold; font-size:15pt; color:#003399; text-decoration:none"><font color="#808080">zoOom in</font> +</a></td> <td style="border:3 solid #000000" align="middle"><a href="#" onmouseover="javascript:resume_zoom();set_original();" style="font-family:verdana,arial,helvetica; font-weight:bold; font-size:15pt; color:#000000; text-decoration:none">original</a></td> <td style="border:3 solid #000000" align="middle"><a href="#" onmouseover="javascript:resume_zoom();zoom_out();" onmouseout="javascript:pause_zoom();" style="font-family:verdana,arial,helvetica; font-weight:bold; font-size:15pt; color:#003399; text-decoration:none"><font color="#808080">ZOoOM out</font> -</a></td> </tr></table> <!--END ZOOM LINKS--> </body> </html> <?php require('includes/application_bottom.php'); ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.