Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Small (Thumbnail) Images - Big Images - Simplest Way?


beckysmith

Recommended Posts

Posted

afaik it should work with MS1 but it doesn't seem to work even on a standalone basis - you just get zero byte images. I checked through the code and couldn't find any problem there.

  • 2 weeks later...
  • 1 year later...
Posted

I couldn't get the solution posted by Dreamscape to work, but by playing with it I tried this and it worked - I'm posting it in case it helps anyone.

 

In the file "popup_image.php" I changed the <body> section from this:

 

<body onload="resize();">

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

</body>

 

To this:

 

<body onload="resize();">

<?php echo tep_image(DIR_WS_IMAGES.'/images_big/'.$products['products_image'], $products['products_name']); ?>

</body>

 

images_big is the name of my subdirectory under images, and the big images have the same names as the thumbnails.

 

Carolyn St. Louis

  • 2 years later...
Posted

I had a similar problem. My solution is very simple as it's all handled in Photoshop. I start by creating a 600 x 600 pixel template page with a white background in photoshop. Next I size my product image in Photoshop to fit that space, then copy and paste to the 600x600 template. I save this for web in PS. In osC I set my image size to 150 x 150 pixels. This way the catalog displays a 150 pixel square image, but clicking on the enlarge link brings up the 600 pixel image. My beef with this approach is that the smaller image in the catalog is typically not at the resolution I would like, even though it's a direct mathmatical reduction (25%). Have a look:

 

www.claybaker.com/shop

 

Clay

  • 2 months later...
Posted
this is what I do... it was part of a contrib that was similar, but used the PHP imaging features to resize the big image to thumbnails, which I did not like...

step 1: open popup_image.php and change the BODY to this:

<body onload="resize();">

<?php
define('IN_IMAGE_SUBDIR','images_big/');

// if the big image isn't shown unkomment the next line, and check the path:

// maybe you have to remove '/'. or adjust the path, depends on your configuration 

  // echo DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

         if (is_file(DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'])) {

               $image=DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

         }

         else {

               $image=DIR_WS_IMAGES . $products_values['products_image'];

         }

          echo tep_image($image, $products_values['products_name']);

?>
</body>

This code basically looks for an image in the directory "images/images_big" and shows it if it is there... if not, it will show the thumbnail...

thats it! Just put the thumbnails in your images directory, and create a directory called "images_big" inside the images folder (images/images_big) and upload the full size images into the images_big folder. The thumbnails can be uploaded via admin... but I don't have a solution to upload the big images via admin... using FTP to upload them works just as well I think.

 

 

Your method sounds great. Unfortunately I can't make it work.

 

For now I'm doing all this on my internal (WIN_XP) server "Apache 2" , "PHP Version 5.0.4", "MySQL v5".

 

I used copy and paste to insert the code where you suggested (replacing the existing code, which does work by the way when I flip code segments, but then it of course only shows the thumbnail image). Using your path test I did notice the '/' had to be removed as it inserts an extra slash (//). Anyway when I attempt to "enlarge", the pop-up window shows a broken image link. Using "properties" I get the following: http://localhost/kandy/catalog/popup_image.php?pID=35

 

My large image is in a directory called "images_big" inside my "images" directory. I'd love for this to work! Any idea what might be wrong?

 

-Hank :huh:

Posted

I used the method that dreamscape suggested,

 

when I click on enlarge image it doesnt come up - just has a red x in the corner. I have checked the paths and they look correct. I have even fiddled wth them but to no avail. My large picture is of the same name as my thumb nail and I uploaded it straight in to the images_big folder using file manager.

 

Could this be anything to do with me having installed the easy populate contribution?

Or am I supposed to upload it in a different way?

 

I am a newbie so any explanations of the simple kind would be greatly appreciated.

I feel so stupid for asking such a pathetic question but I am so gratefull to all of you who contribute to this forum to help clueless people like me - thank you so much!

 

Kelly

  • 2 weeks later...
Posted
I used the method that dreamscape suggested,

 

when I click on enlarge image it doesnt come up - just has a red x in the corner. I have checked the paths and they look correct. I have even fiddled wth them but to no avail. My large picture is of the same name as my thumb nail and I uploaded it straight in to the images_big folder using file manager.

...

Have you checked the permissions on your images_big folder and the images inside it?

 

Get the url of an image in the images_big folder (right click on the square with the red 'X' and view properties) and try to view it in your browser. The resulting message can be helpful.

Posted

I used the follwing:

 

<?php echo tep_image(DIR_WS_IMAGES.'/images_big/'.$products['products_image'], $products['products_name']); ?>

 

that "Carolyn St. Louis" contributed above and it works as advertised. I could not get the longer version to work previously.

 

Thanks,

David

  • 3 weeks later...
Posted

Its much easier for me if I can upload the big pictures too in the page where I create new products.

I don't know what to do.. :huh: Can anybody help me??

 

Thanks.

Ronald

 

See the picture > (I made it with Paint)

photosmall_big.png

Posted

i got the popup to show the large image , but the window isnt the "right size", there's still some parts that you cant see at the bottom and you have to enlarge the window urself, what should i do so the window will load appropriately.

 

thanks

Posted

You have to change

 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);

in

 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+110-i);

 

 

But does anybody know an answer on my question?? :(

Posted
Its much easier for me if I can upload the big pictures too in the page where I create new products.

I don't know what to do.. Can anybody help me??

 

Thanks.

Ronald

 

See the picture > (I made it with Paint)

Reduced: 96% of original size [ 663 x 297 ] - Click to view full image

 

Why don't you people upload the original (big) picture and have thumbnail contribution installed?

Posted
Why don't you people upload the original (big) picture and have thumbnail contribution installed?

 

Becuase the thumbnails become a poor quality then...

  • 2 weeks later...
Posted

This is exactly what I need to do for my website, but am having difficulties in getting the popup image to show. DESPERATELY hoping you can help.

 

I've set up the image_big subdirectory and uploaded the popup image file I wish to use using the same name as the thumbnail image in the original image directory. However, when test it, I get the red x box and text showing the directory path "/home/gtwoclot/public_html/shop//images/images_big/" and then noted in the title bar above that is "http://gtwoclothing.com/shop/popup_image.php?pID=220"

 

Here is my code for popup_image.php. A HUGE and sincere thank you in advance for your help!!!!!

 

<?php
/*
 $Id: popup_image.php,v 1.18 2003/06/05 23:26:23 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 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 = '" . (int)$HTTP_GET_VARS['pID'] . "' and pd.language_id = '" . (int)$languages_id . "'");
 $products = tep_db_fetch_array($products_query);
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo $products['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();
}
//--></script>
</head>

<body onLoad="resize();">

<?php



define('IN_IMAGE_SUBDIR','images_big');

// if the big image isn't shown uncomment the next line (48), and check the path:

// maybe you have to remove '/'. or adjust the path, depends on your configuration 

  echo DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

        if (is_file(DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'])) {

              $image=DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

        }

        else {

              $image=DIR_WS_IMAGES . $products_values['products_image'];

        }

         echo tep_image($image, $products_values['products_name']);

?>



</body>
</html>
<?php require('includes/application_bottom.php'); ?>

  • 3 months later...
Posted

I think my problem is an easy fix for the experienced. I've had success with my big_images access on my local site, but when I try to apply the same popup_image code to my live site I get the following:

 

/home/content/m/y/s/mysite/html/ /images/images_big/pic.jpg

*This is after uncommenting the echo command as my pics were staying the same size on the live site.

 

As you can see, I've managed to create an extra space and slashie before the images directory. Where should I look to remove this? Many thanks.

  • 5 months later...
Posted

this code looks great! just wondering why get this message after deployment:

 

Parse error: parse error, unexpected T_STRING in /home/artglas1/public_html/store/popup_image.php on line 49

 

amypossible-solution-best-regarded

 

d

 

 

 

this is what I do... it was part of a contrib that was similar, but used the PHP imaging features to resize the big image to thumbnails, which I did not like...

step 1: open popup_image.php and change the BODY to this:

<body onload="resize();">

<?php
define('IN_IMAGE_SUBDIR','images_big/');

// if the big image isn't shown unkomment the next line, and check the path:

// maybe you have to remove '/'. or adjust the path, depends on your configuration 

  // echo DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

         if (is_file(DIR_FS_CATALOG.'/'.DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'])) {

               $image=DIR_WS_IMAGES.IN_IMAGE_SUBDIR.$products_values['products_image'];

         }

         else {

               $image=DIR_WS_IMAGES . $products_values['products_image'];

         }

          echo tep_image($image, $products_values['products_name']);

?>
</body>

This code basically looks for an image in the directory "images/images_big" and shows it if it is there... if not, it will show the thumbnail...

thats it! Just put the thumbnails in your images directory, and create a directory called "images_big" inside the images folder (images/images_big) and upload the full size images into the images_big folder. The thumbnails can be uploaded via admin... but I don't have a solution to upload the big images via admin... using FTP to upload them works just as well I think.

Posted

Gee guys, there are addons that do this stuff.

  • 3 months later...
Posted

Hi,

I have a question...

I am trying to develop an oscommerce website where till now everything seems to work fine except the images of the products...

The link is http://mid-nignttemptation.com/final5/index.php?cPath=26

 

When ever any category is clicked on the left hand side the larger images shows up instead of thumbnails...

 

Can any one plzzz help me with this.........

  • 1 year later...
Posted

Hello guys

 

I hava a problem with thumbnail images, they are not shown in shop, but when i click on them I can see big picture.

Both thumbnail and original picute are on server and can be seen.

 

Thank you for sugestions.

Archived

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

×
×
  • Create New...