Forums / Templates, Stylesheets, Page Layout / How to call MED image info on main page? Not an IMG but the path. Help please !

How to call MED image info on main page? Not an IMG but the path. Help please !

Locked

Started by yuchant on 24 Sep 2007, 6:31 AM · Views: 1,276

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
24 Sep 2007, 6:31 AM
#1
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

How to call MED image info on main page? Not an IMG but the path. Help please !

Let me begin by saying i've never touched php or javascript and am digging myself into this code trying to figure it out.

Ive decided to put the javascript link in the common header template (i guess i should make it more specialized) but more importantly i'm editing new_products.php to insert the tag that will call the javascript for mouseover.

problem is.. I dont know how to call path_to_med_graphic.png?

I'm looking at other parts of the core to get an idea but it looks like they draw variables from whatever other php file is executing the little bits so i'm confused. I dont know how to climb up the code ladder.

I just need a way to write "images/medium/xxxxxxx_MED.png" per product on the front page.

Ideally for any small graphic, but hey i'm not gonna bite off more than i can chew. Thanks guys.

:smartalec: these are nice faces

24 Sep 2007, 1:07 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

I just need a way to write "images/medium/xxxxxxx_MED.png" per product on the front page.
Besides what you explained as how you want to change the code - What is it that you are trying to do?

May be easier to make your standard image a bit larger in the admin and use proportional images setting for others that need to be smaller.

Zen-Venom Get Bitten

24 Sep 2007, 3:01 PM
#3
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

I am trying to use a javascript zoom script on my small images.

Basically I just need to know what function brings out the path to larger image.

I'm working on includes/modules/custom/new_products.php

I'm just editing the tag that every "new product" comes with.

  'style="position:relative" onmouseover="showtrail(\' PATH HERE (images/medium/blank_MED.png' . '\',\'' . $new_products->fields['products_name'] . '\',250,130,350,373,this,0,0,250,130);" onmouseout="hidetrail();"') . '</a><br />')
24 Sep 2007, 5:34 PM
#4
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

Why don't you use image handler 2 mod? It does exact the same thing (and more)

I no longer provide installation support on forum for all my modules. However, if there are real bugs with the modules please feel free to contact me

24 Sep 2007, 7:47 PM
#5
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

yellow1912:

Why don't you use image handler 2 mod? It does exact the same thing (and more)

Hey thanks for the response. I dont use IH2 because my small images are not shrunken larger images. Plus, when I use IH2 and try to use my own images, it resizes my images to their same dimentions (as specified in the configs) but makes them 20 times larger in file size.

Basically, I just want that zoom function.

My only question is how do I get that path in there? $new_products->fields['products_image'] gives me the small image path.

I just want 'images/medium/products_id_MED.png

24 Sep 2007, 8:23 PM
#6
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

I have no clue what i'm doing here but I put

require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE));

at the beginning of "new products" template which I hope wont query it every product.

Then I could use the naming machine but i dont know how to put values into $products_image_medium.

Products_image_medium doesnt know what product its trying to "mediumize"

So when I use $products_image_medium right now i get images/medium/_MED.png.

Every example of this I see is from using zen_image($products_image_medium, $products_name ) which is not what I want.

24 Sep 2007, 9:17 PM
#7
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

Alright.
I'm pretty excited as I managed to get SOME results from knowing nothing.

I put this inside the WHILE

require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE));

and put a value into $products_image ```php
$products_image = $new_products->fields['products_image'];


but when I use that variable in $products_image_medium I get a mismatched image. 

I dont know what to think because in the very next space $new_products->fields['products_name'] is called and its CORRECT but the code right before that gives me a $new_products->fields['products_image'] of the previous product. 

Here is the code line 62 in new_products.php if anybody could point out where to define my $products_image for the medium filename changer

```php
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT, 'style="position:relative" onmouseover="showtrail(\'' .  $products_image_medium . '\',\'' . $new_products->fields['products_name'] . '\',250,130,350,373,this,0,0,250,130);" onmouseout="hidetrail();"') . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);

Again I have no programming knowledge so any help is greatly appreciated.

24 Sep 2007, 9:30 PM
#8
yuchant avatar

yuchant

New Zenner

Join Date:
Sep 2007
Posts:
18
Plugin Contributions:
0

Re: How to call MED image info on main page? Not an IMG but the path. Help please !

Okay fantastic!!! looks like I solved it by defining products_image before the while statement for the first item, and by moving the second definition before the require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE))

I definitely didnt expect to be able to do that.

Which is plenty good for me now. I guess this means I will put this code in New_products, Featured_products, products_all and everything where my small images are used?

Please let me know if there is a better way to affect all of these templates. Thanks!

So the end it looks like this: ```php
if ($num_products_count > 0) {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) {
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
}
$products_image = $new_products->fields['products_image'];

while (!$new_products->EOF) {
$products_image = $new_products->fields['products_image'];
require(DIR_WS_MODULES . zen_get_module_directory(FILENAME_MAIN_PRODUCT_IMAGE));

$products_price = zen_get_products_display_price($new_products->fields['products_id']);
$new_products->fields['products_name'] = zen_get_products_name($new_products->fields['products_id']);

$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT, 'style="position:relative" onmouseover="showtrail(\'' .  $products_image_medium . '\',\'' . $new_products->fields['products_name'] . '\',250,130,350,373,this,0,0,250,130);" onmouseout="hidetrail();"') . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);

Now i need to have these preloaded, however the hell you do that.