Forums / General Questions / What is the path for images?

What is the path for images?

Locked

Views: 5,031

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
8 Oct 2006, 5:02 AM
#1
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

What is the path for images?

How is the iamge path written? I see this code> . DIR_WS_TEMPLATE .but I don't know how to complete it to display an image from a template folder.

I want to display an image from whichever is the default template folder without changing the path each time I switch templates. The image names are the same but look different for each template I use.

8 Oct 2006, 10:16 AM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,724
Plugin Contributions:
56

Re: What is the path for images?

In include/configure.php you'll see

define('HTTP_SERVER', 'http://www.higher-graphics.com');
...
define('DIR_WS_CATALOG', '/');
...
define('DIR_WS_IMAGES', 'images/');

concatenate these three values, and that's the path for images.

Good luck,
Scott

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

8 Oct 2006, 2:57 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: What is the path for images?

Or, if you want it to detect the correct path based on your active template, you can use this code (from tpl_header.php) as an example:```
<div id="logo"><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">' . zen_image($template->get_template_dir(HEADER_LOGO_IMAGE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . HEADER_LOGO_IMAGE, HEADER_ALT_TEXT) . '</a>'; ?></div>

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Oct 2006, 1:44 AM
#4
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: What is the path for images?

Thanks for both suggestions. I want to clarify my purpose as neither is doing what I want or I don't understand how to apply either to achieve my objective.

In tpl_header.php I removed all the header stuff and replaced it with an image like this

<div id="headerWrapper"><div><img src="/zen/includes/templates/shade/images/header.jpg" alt="" /></div> ...</div>

The image name is the same in 3 templates but since the folder names are different when I switch template via the admin panel I have to edit the path each time.

I need the php/smarty path that Zen uses to identify a template folder and it's image directory so the image will be found when templates are switched. Sorta like this code from OSC

<?php echo tep_image(DIR_WS_IMAGES . 'foot.jpg'); ?>
12 Oct 2006, 5:58 PM
#5
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: What is the path for images?

So I tried this with no success

<div><?php echo '<img src="' . zen_image($template->get_template_dir(DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . footleft.gif) . '/>'; ?></div>
12 Oct 2006, 8:37 PM
#6
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: What is the path for images?

Something happened with this change but still no image display

<div><?php echo ' . zen_image($template->get_template_dir(DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . footleft.gif) . '; ?></div>

Any suggetstions on this?

13 Oct 2006, 5:17 AM
#7
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: What is the path for images?

Just want to know the global path to the image directory of the template in use. The method posted above is logical but I don't know how to apply it. I don't need the image to link so I need the code without the link reference. I have tried it in many ways but none seem to work.

13 Oct 2006, 5:43 AM
#8
seethrou avatar

seethrou

Totally Zenned

Join Date:
May 2004
Location:
Hong Kong
Posts:
1,156
Plugin Contributions:
0

Re: What is the path for images?

You may refer to the file
includes/languages/english/extra_definitions/product_free_shipping.php

define('TEXT_PRODUCT_FREE_SHIPPING_ICON', zen_image(DIR_WS_TEMPLATE_IMAGES . 'always-free-shipping.gif', 'Always Free Shipping'));

Below is simplified from both of the discussions above and only with the basic.

<div id="logo1"><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'test.gif') . '</div>'; ?>

And from page source of my test it show as.

<div id="logo1">
<img width="240" height="160" alt="" src="includes/templates/future_zen_4/images/test.gif"/>
</div>

The image can be seen and under the override directory.

By viewing page source, always helps to trace, isolate problems, debug and minimize the time in development.

Note:

  1. the raw image size for the test.gif in above test is 240 x 160 px and no parameter was entered in the above test.
  2. the **alt="" ** is for the no alter text entered.

.

A New Starter again

13 Oct 2006, 1:32 PM
#9
maxima avatar

maxima

New Zenner

Join Date:
Jun 2006
Posts:
86
Plugin Contributions:
0

Re: What is the path for images?

Seethrou that worked exactly as I want. Many thanks. Now maybe you could help me solve this IE spacing problem. I have a post regarding that at http://www.zen-cart.com/forum/showthread.php?t=48747