Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing img to embed


Babysweet

Recommended Posts

Posted

I want to embed a video into the code, however because the <img> tag is hidden in the tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])

I need to find where this variable is assigning the <img> so I can make the <embed> ateration.

 

any assistence will be much apprieciated.

Sincerely,

Joseph Seabert

Posted

the image function is in includes/functions/html_output

i havent embedded video before so im not 100% sure what you need to modify

 

the image function is shown below

 

--START CODE

 

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

return false;

}

 

--END CODE

 

the variable $src is the image link - think this is what you need to modify

I assume this is grabbed from the database in the case of products images

 

each product image is uploaded by you so you could modify this so it adds the embed code into the database along with the name of the image.

i may have got the wrong end of the stick so aoplogies if i have.

always here to offer some useless advice....

Posted

Thanks I will see what I can do, if it works I will post my results

Sincerely,

Joseph Seabert

Posted

Ok this is what I have done, and the following results have confused me.

 

I have altered html_output from this

// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
     return false;
   }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

   if (tep_not_null($alt)) {
     $image .= ' title=" ' . tep_output_string($alt) . ' "';
   }

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
     if ($image_size = @getimagesize($src)) {
       if (empty($width) && tep_not_null($height)) {
         $ratio = $height / $image_size[1];
         $width = $image_size[0] * $ratio;
       } elseif (tep_not_null($width) && empty($height)) {
         $ratio = $width / $image_size[0];
         $height = $image_size[1] * $ratio;
       } elseif (empty($width) && empty($height)) {
         $width = $image_size[0];
         $height = $image_size[1];
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

   if (tep_not_null($width) && tep_not_null($height)) {
     $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
   }

   if (tep_not_null($parameters)) $image .= ' ' . $parameters;

   $image .= '>';

   return $image;
 }

To

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
     return false;
   }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

   if (tep_not_null($alt)) {
     $image .= ' title=" ' . tep_output_string($alt) . ' "';
   }

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
     if ($image_size = @getimagesize($src)) {
       if (empty($width) && tep_not_null($height)) {
         $ratio = $height / $image_size[1];
         $width = $image_size[0] * $ratio;
       } elseif (tep_not_null($width) && empty($height)) {
         $ratio = $width / $image_size[0];
         $height = $image_size[1] * $ratio;
       } elseif (empty($width) && empty($height)) {
         $width = $image_size[0];
         $height = $image_size[1];
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

   if (tep_not_null($width) && tep_not_null($height)) {
     $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
   }

   if (tep_not_null($parameters)) $image .= ' ' . $parameters;

   $image .= '>';

   return $image;
 }

// The HTML video wrapper function
 function tep_video($srcv, $altv = '', $widthv = '', $heightv = '', $parametersv = '') {
   if ( (empty($srcv) || ($srcv == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
     return false;
   }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $video = '<embed src="' . tep_output_string($srcv) . '" border="0" alt="' . tep_output_string($altv) . '"';

   if (tep_not_null($altv)) {
     $video .= ' title=" ' . tep_output_string($altv) . ' "';
   }

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($widthv) || empty($heightv)) ) {
     if ($video_size = @getimagesize($srcv)) {
       if (empty($widthv) && tep_not_null($heightv)) {
         $ratiov = $heightv / $image_sizev[1];
         $widthv = $video_size[0] * $ratiov;
       } elseif (tep_not_null($widthv) && empty($heightv)) {
         $ratiov = $widthv / $video_size[0];
         $heightv = $video_size[1] * $ratiov;
       } elseif (empty($widthv) && empty($heightv)) {
         $widthv = $video_size[0];
         $heightv = $video_size[1];
       }
     } elseif (IMAGE_REQUIRED == 'false') {
       return false;
     }
   }

   if (tep_not_null($widthv) && tep_not_null($heightv)) {
     $video .= ' width="' . tep_output_string($widthv) . '" height="' . tep_output_string($heightv) . '"';
   }

   if (tep_not_null($parametersv)) $video .= ' ' . $parametersv;

   $video .= '>';

   return $video;
 }

 

And Have changed product_info from

<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>

To

<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_video(DIR_WS_IMAGES . $product_info['products_video'], addslashes($product_info['products_name']), LARGE_IMAGE_WIDTH, LARGE_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>

and added to the data base in the Products table products_video and with the link dvd/ibrator.mov

 

with all of this, the following is the result

<script language="javascript"><!--
document.write('<a href="javascript:popupWindow(\'http://92engbn.us/ecommerce/os/catalog/popup_image.php?pID=20\')"><embed src="images/" border="0" alt="Beloved" title=" Beloved " width="300" height="240" hspace="5" vspace="5"><br>Click to enlarge</a>');
//--></script>

 

notice the link for dvd/ibrator.mov is not appearing after the <embed src="images/

I am out of ideas as to why this is happening,

hopefully you will see what I am not.

Sincerely,

Joseph Seabert

Posted

no suggestions??? oh well thought it would be cool to try to get the store to do something alittle dynamic.

Sincerely,

Joseph Seabert

Posted

have you altered the select statement so products video is put into the array??

i cant see where '$product_info['products_video']' is set? so maybe thats why?

i may just have missed it in the code though....

always here to offer some useless advice....

Posted
have you altered the select statement so products video is put into the array??

 

where does this array reside, you may have isolated the problem, however I am unable to find the array that you are talking about.

Sincerely,

Joseph Seabert

Posted

its early here so forgive the stupid question!

 

where are you trying to display these images?

in the product listing?

or on product info page?

or on both?

always here to offer some useless advice....

Posted

right

 

try the queries on index.php

this should help fix the product listing display by allowing the video link to go into the array

 

---CODE START

 

// We are asked to show only a specific category

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_price1,p.products_price2,p.products_price3,p.products_price4,p.produc

ts_price1_qty,p.products_price2,p.products_price3_qty,p.products_price4_qty,p.pro

ducts_qty_blocks, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";

} else {

// We show them all

$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_price1,p.products_price2,p.products_price3,p.products_price4,p.produc

ts_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_price4_qty,p

.products_qty_blocks, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";

}

 

---CODE END

 

the code above is my modified code but you should have something similar(!) just find it in your code and just add

 

p.products_video

 

to each select statment

 

i think there are four select statements in that area that you need to add it to

 

hope that works

let me know when i can view it cos i am intrigued by this :D

if that works then ill look for the select statement used on product info

always here to offer some useless advice....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...