Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Generating thumbnails in 2.3.3.4BS for product_info


Recommended Posts

I'm working on adapting/writing a thumbnailer for 2334BS that creates thumbnails for images for different pages. Now I'm trying to do it for product_info.php.

 

In previous versions there was a reference to tep_href_link so you could put a small thumbnail for the product page and a bigger image for the popup:

$pi_entry .= tep_href_link(DIR_WS_IMAGES . $pi['image'], '', 'NONSSL', false); // // popup image
$pi_entry .= '" target="_blank" rel="fancybox">' . tep_image(DIR_WS_IMAGES . $pi['image']) . '</a>'; // thumbnail

From what I see in 2334BS product_info.php now you can only pass a single image to tep_image that is used (resized on cllient side) for the thumbnail in product_info page and in the popup image:

        while ($pi = tep_db_fetch_array($pi_query)) {
          $pi_counter++;

          if (tep_not_null($pi['htmlcontent'])) {
            $pi_html[] = '<div id="piGalDiv_' . $pi_counter . '">' . $pi['htmlcontent'] . '</div>';
          }
			/// Varias imagenes
          echo tep_image(DIR_WS_IMAGES . $pi['image'], '', '', '', 'id="pGalImg_' . $pi_counter . '"');

This forces the product page to load full res images.

 

Could somebod point me to the code snippet that generates the href link now? I'm getting lost into those javascript snippets.

Link to comment
Share on other sites

Hi,

 

I've solved this (small thumbnail with big pop-up image) this way:



echo tep_image({THUMBNAIL}, '', SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'id="piGalImg_' . $pi_counter . '" data-highres="'. {BIG POPUP} .'"');

In which "{THUMBNAIL}" is the thumbnail (including the path) (i.e. "DIR_WS_IMAGES . $pi['image']") and "{BIG POPUP}" is big image (including the path).

 

AD

Link to comment
Share on other sites

Thanks @@AngusD! I figure I could add data-highres to the tep_image function directly so it can generate the small and big thumbnails at once and serve them to product_info page.

 

Do you currently use any thumbnail addon?

Link to comment
Share on other sites

Hi,

 

I wouldn't call it an addon.

 

I've modified the categories.php and upload.php myself, so that it creates a thumbnail when I upload an image, when I create a new product or edit an existing product.

It's not perfect, but it satisfies my needs.

 

AD

Link to comment
Share on other sites

Very interesting solution, I didn't think of it. I've tried almost all of the thumbnails add-ons and I was using Imagemagic for now on my 2.2 store, but I was trying to figure out a better solution for 2334BS. Yours looks easier than what I was thinking about.

Link to comment
Share on other sites

Thanks, because it is relatively easy. You just need to create a thumbnail once and that's when you upload an image.

 

I've used the GD-library, but ImageMagick works too. What I've seen, it's probably even easier with ImageMagick.

 

AD

Link to comment
Share on other sites

  • 10 months later...

Hi,

 

I've solved this (small thumbnail with big pop-up image) this way:


echo tep_image({THUMBNAIL}, '', SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'id="piGalImg_' . $pi_counter . '" data-highres="'. {BIG POPUP} .'"');

In which "{THUMBNAIL}" is the thumbnail (including the path) (i.e. "DIR_WS_IMAGES . $pi['image']") and "{BIG POPUP}" is big image (including the path).

 

AD

Hello Rene @@AngusD,

 

I modified this line to get also the small pics reduced to correct thumbnail size, depending on the amount of additional images (example for KissIt Image thumbnailer):

          echo tep_image(DIR_WS_IMAGES . $pi['image'], '', (($pi_counter > 1 )? KISSIT_MAIN_PRODUCT_IMAGE_WIDTH/(($pi_total <= 5)? $pi_total-1 : 5) : KISSIT_MAIN_PRODUCT_IMAGE_WIDTH), (($pi_counter > 1 )? KISSIT_MAIN_PRODUCT_IMAGE_HEIGHT/(($pi_total <= 5)? $pi_total-1 : 5) : KISSIT_MAIN_PRODUCT_IMAGE_HEIGHT), 'id="piGalImg_' . $pi_counter . '" data-highres="'. DIR_WS_IMAGES . $pi['image'] .'"');
Link to comment
Share on other sites

Archived

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

×
×
  • Create New...