Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Is it possible to resize image just on Product page


PJ2006

Recommended Posts

Hi,

 

I want to be able to have a larger product image on my image page, but to keep small images else where. Is this possible.

 

I did look at installing Bigger Product Image, but I don't think I can as I'm use Simple Pop up contrib to resize my pop-up window and they both want changes to the same code. Is there any other way to do this?

 

Thanks

Link to comment
Share on other sites

The quick and easy way is to replace SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT in the product_info.php file with the sizes you want. That means you have to edit the file if you ever want to change those though. It would be better to create new items in the database and use those.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

The quick and easy way is to replace SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT in the product_info.php file with the sizes you want. That means you have to edit the file if you ever want to change those though. It would be better to create new items in the database and use those.

 

Jack

Hi Jack,

 

Thanks for your reply. How do I create new items in the database?

 

Thanks Lotti

Link to comment
Share on other sites

Do the following:

 

- go to your hosts control panel and open up phpmyadmin (how you do this varies with control panels so you may need to ask your host)

 

- select your database

 

- click on the mysql tab

 

- paste these lines in that box and click go. Be sure to change the XX to whatever name you want to use. So Small Image Width LL can be My New Width (or anything unique). The other one in capital letters typically is named the same but each word is connected by an underscore and the letters are all capitals. So SMALL_IMAGE_WIDTH_XX would be MY_NEW_WIDTH, for example.

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Small Image Width XX', 'SMALL_IMAGE_WIDTH_XX', '100', 'The pixel width of small images', '4', '10', now());
INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Small Image Height XX', 'SMALL_IMAGE_HEIGHT_XX', '80', 'The pixel height of small images', '4', '11', now());

 

- edit the SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT items in the product_info.php file to be the same as the ones you just created - MY_NEW_WIDTH.

 

Then go to admin and set the new width and height settings to what you want and the image will now have its own settings.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

As an alternative - assuming you have set your small image size in admin to (as an example) 125 pixels high and 125 pixels wide and want the image on the product info page to be twice that, ie 250 x 250.

 

Open the product_info.php file found in catalog/

and around line 108 change the code of SMALL_IMAGE_WIDTH and HIEGHT to include *2

 

Like this

 

<script language="javascript"><!--

document.write('<?php echo '<a href="java script: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']), SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

 

 

And that will do what you are trying to achieve without having to touch your database.

 

F5

Link to comment
Share on other sites

As an alternative - assuming you have set your small image size in admin to (as an example) 125 pixels high and 125 pixels wide and want the image on the product info page to be twice that, ie 250 x 250.

 

Open the product_info.php file found in catalog/

and around line 108 change the code of SMALL_IMAGE_WIDTH and HIEGHT to include *2

 

Like this

 

<script language="javascript"><!--

document.write('<?php echo '<a href="java script: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']), SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

</td>

And that will do what you are trying to achieve without having to touch your database.

 

F5

 

 

Thank you both so much for you're help, I've been struggling with this one for weeks!!!!

 

 

Very, very greatly appreciated.

 

Lotti

Link to comment
Share on other sites

Or you could use this contribution:

 

http://www.oscommerce.com/community/contributions,1032

 

It lets you specify different size files for the image, a smaller one for the lists, etc and a larger one for the product page...

 

Do you know if it's possible to install this contribution if you already have the resize pop-up window contribution installed?

 

Thanks Lotti

Link to comment
Share on other sites

  • 4 months later...
Thank you both so much for you're help, I've been struggling with this one for weeks!!!!

Very, very greatly appreciated.

 

Lotti

I have tried the *2 in the product info section, and your right it does work; however i am having a problem. I have no image contribs installed i have tried on numerous attempts just have way to much code to compare and change especially when you have a modified install already..... Back to the *2 tip..... It works the problem i am experiencing is most times it is *2 the thumbnail instead of the actual image.... For example all the images i upload are at least 300 pixels wide... and my small_image is set to 100. when i do the *2 it is using the systems created 100 thumbnail instead of the 300.... so i am getting the original scaled down from 300 to 100 and then scaled up to 200 .... basically the picture looks like crap.... but if i do a refresh you get the original 300 image.... is anyone else experiencing this..... any fixes?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...