Forums / Templates, Stylesheets, Page Layout / How can I use medium images on product listing page, and thumbnails in sideboxes?

How can I use medium images on product listing page, and thumbnails in sideboxes?

Locked

Views: 3,020

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
23 Dec 2008, 3:52 AM
#1
greydawgjr avatar

greydawgjr

New Zenner

Join Date:
May 2008
Posts:
65
Plugin Contributions:
0

How can I use medium images on product listing page, and thumbnails in sideboxes?

Hello All,

I hope someone can help with a problem I'm trying to solve. I know how to change the displayed image size in various areas, however since I have images in my images, /medium, and /large directories I'd like to use the medium sized images on my product listing page instead of the thumbnail sized since I'm having cross-browser issues when I rely on the browser to handle resizing the images for me.

I've tried editing the product_listing.php page which currently has:

zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"')

I've tried including the main_product_image.php file then changing the code to:

zen_image(DIR_WS_IMAGES . 'medium/' . $products_image_medium, $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"')

with no luck.

Can someone tell me how to edit this file to use the image in the medium directory instead of the thumbnail stored in the products_image listing?

Thanks!

23 Dec 2008, 7:34 PM
#2
dscott1966 avatar

dscott1966

Zen Follower

Join Date:
Apr 2005
Posts:
298
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

Can someone give some insight on this i would like to know how it can be done also.

Thank you

24 Dec 2008, 6:35 PM
#4
dscott1966 avatar

dscott1966

Zen Follower

Join Date:
Apr 2005
Posts:
298
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

No one has a thought on how this can be done? Please help

24 Dec 2008, 8:53 PM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

$products_image_medium
I doubt the value of this variable is set correctly unless the currently operating code explicitly sets it. See if you can find the product main image display file or function; that has the steps to disassemble the value provided by $listing->fields['products_image'] and convert it to the medium image name.
If you have any facility with PHP, you can probably use standard functions to strip and save the last 4 characters from $listing->fields['products_image'], add '_MED', and restore the extension. This presumes a 3-character extension, but that's a pretty safe bet.

24 Dec 2008, 9:02 PM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

Note: "echo" is your friend while working on this, to see what the actual value of a variable is at different stages of the process.

8 Jan 2009, 4:19 AM
#7
greydawgjr avatar

greydawgjr

New Zenner

Join Date:
May 2008
Posts:
65
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

gjh42:

Note: "echo" is your friend while working on this, to see what the actual value of a variable is at different stages of the process.

Hi Glenn,

Thanks for the input, I meant to reply earlier but got busy with the holidays.

I was hoping that including the main_product_image file would define $products_image_medium for me since it's defined there and they've already done the work of separating out the base name from the extension and appending _MED to it.

The result I'm getting from the method I've tried above gives me this with an echo:
images/medium/_MED
so I'm somehow still missing the file name and the extension, but I somehow get the medium suffix.

So close yet so far!

Any ideas would be appreciated.

8 Jan 2009, 6:56 AM
#8
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

images/medium/_MED

So that is the value of $products_image_medium just before the zen_image statement starts? Doesn't seem like it should be.

8 Jan 2009, 3:27 PM
#9
greydawgjr avatar

greydawgjr

New Zenner

Join Date:
May 2008
Posts:
65
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

gjh42:

images/medium/_MED

So that is the value of $products_image_medium just before the zen_image statement starts? Doesn't seem like it should be.

No, that's what the zen_image statement produces, which is strange because $products_image_medium is obviously working for that but nothing else...

8 Jan 2009, 5:06 PM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

OK, the value of $products_image_medium is _MED, then. Sounds like the variable originally has a null value, and after the filename manipulation the inserted _MED is the only content. Can you post the file to see what it is really doing to get this? Use ```
[php] and [/php]


You may be better off doing the filename modification yourself, as long as you make sure there is always a medium file to use.
19 Jan 2009, 8:32 PM
#11
justlost avatar

justlost

New Zenner

Join Date:
Dec 2008
Posts:
11
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

try this:

$img_med = DIR_WS_IMAGES . 'medium/' . $listing->fields['products_image'];
$dot_pos = strrpos($img_med, '.');
$img_med = substr($img_med, 0, $dot_pos) . '_MED' . substr($img_med, $dot_pos);

Now, $img_med will have the correct url to your image.

So this:

zen_image(DIR_WS_IMAGES . $listing->fields['products_image'], $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"')

Becomes this:

zen_image($img_med, $listing->fields['products_name'], IMAGE_PRODUCT_LISTING_WIDTH, IMAGE_PRODUCT_LISTING_HEIGHT, 'class="listingProductImage"')

So I would place the URL snipet of code around line 160, right after the "case 'PRODUCT_LIST_IMAGE':", then you can use the $img_med after that.

Cheers!

25 May 2009, 8:50 PM
#12
dwmdwm avatar

dwmdwm

New Zenner

Join Date:
Jan 2009
Posts:
1
Plugin Contributions:
0

Re: How can I use medium images on product listing page, and thumbnails in sideboxes?

thank you, can you tell me How can I use medium images on all product page.