Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing image display


mark27uk3

Recommended Posts

Posted

Hi Guys,

 

I am experimenting again with my store and I would like to change the product_info from displaying a thumbnail to showing the full size image.

 

I know it has something to do with this bit of javascript, but when I remove the bits for calling the thumbnail the image disappears.

 

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

 

 

I am using the 'On the Fly' Auto Thumbnailer using GD Library contribution if that makes any difference.

 

Any help would be appreciated.

 

with Regards

 

Mark :-"

Lifes a bitch, then you marry one, then you die!

Posted
Hi Guys,

 

I am experimenting again with my store and I would like to change the product_info from displaying a thumbnail to showing the full size image.

 

I know it has something to do with this bit of javascript, but when I remove the bits for calling the thumbnail the image disappears.

 

Mark :-"

 

Here's a little hack in products_info.php I did for the exact same purpose :

 

  if (tep_not_null($product_info['products_image']))
 {
   $extensionFichierImage = substr($product_info['products_image'],-4);
   $nomFichierImage = substr($product_info['products_image'],0,-4);

   $suffixeGrandeImage = '_grand';

   if(file_exists(DIR_WS_IMAGES . $nomFichierImage . $suffixeGrandeImage . $extensionFichierImage))
   {
     echo tep_image(DIR_WS_IMAGES . $nomFichierImage . $suffixeGrandeImage . $extensionFichierImage, $product_info['products_name']);
   }
   else
   {
     echo tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
   }
 }

(The variable names are in French, but it really doesn't matter).

 

Basically, what it does is take the thumbnail filename, and check if there is an image with the same name with "_grand" suffix (make it "_big" for English). If such a file exists, it displays that image instead. If not, then it shows the thumbnail since it's better than showing nothing.

 

I'm not using the javascript thing to show the image though, but I hope it helps.

 

Fred :ph34r:

After three days without programming, life becomes meaningless.

-- The Tao of Programming

Posted

Cool! This is what Im looking for too! Just 2 questions: does it matter where in products_info i put it and do I need that contribution (auto-thumbnailer or what it was called)

 

Thx!

Posted
Cool! This is what Im looking for too! Just 2 questions: does it matter where in products_info i put it and do I need that contribution (auto-thumbnailer or what it was called)

 

Thx!

 

I don't know the auto-thumbnailer contribution (which means I'm not using it, so I guess you don't need it).

 

You should put that code at the place where you want the image to actually appear. I replaced the javascript snippet that displayed the image by the quoted code.

After three days without programming, life becomes meaningless.

-- The Tao of Programming

Posted

Here is the easyest way of doing this mod regardless of what u have installed.

 

1. In the product_info.php change SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,

 

TO

 

PRODUCT_INFO_DISPLAY_WIDTH, PRODUCT_INFO_DISPLAY_HEIGHT,

 

2. Add this SQL via something like PHPmyAdmin

 

INSERT INTO `configuration` VALUES ('', 'Display Width', 'PRODUCT_INFO_DISPLAY_WIDTH', '640', 'Set the Display Width<br>Default (640)', 24, 4, '2004-10-27 10:08:53', '2004-10-27 10:08:53', NULL, NULL);

INSERT INTO `configuration` VALUES ('', 'Display Height', 'PRODUCT_INFO_DISPLAY_HEIGHT', '480', 'Set the Display Height<br>Default (480)', 24, 5, '2004-10-27 10:10:21', '2004-10-27 10:10:21', NULL, NULL);

 

Look into your images part of the admin config and hey presto! you have individal settings for your product info page

 

Hope this helps

 

 

Kind Regards

 

Dave

Posted

Hi Dave,

 

Inserted the sql but there is nothing showing in my images menu!

 

Any ideas why not??

 

Mark

Lifes a bitch, then you marry one, then you die!

Posted

Aghhh BALLS

 

Sorry I got the config catogory id wrong edit the entry that you have put into your database and change the configuration_group_id from 24 into 4

Posted

Okay I have changed the id from 24 to 4 and the options are now there in my admin/images menu but the images have not changed in size, is there only one place in the product_info.php that you have to change.

 

Mark

Lifes a bitch, then you marry one, then you die!

Posted

yeh in product_info.php you need to search for SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT,

 

and replace that with ...

 

PRODUCT_INFO_DISPLAY_WIDTH, PRODUCT_INFO_DISPLAY_HEIGHT,

Posted

Hi Dave,

 

I have managed to get it working however it does not really work for me as the images get distorted too much.

 

Thanks anyway

 

Mark

Lifes a bitch, then you marry one, then you die!

Archived

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

×
×
  • Create New...