chrometweaks.org

Will iPage domains accept google adsense?

Click Here To View All Answers...


Question I have... Will iPage domains accept google adsense? Looking forward for any answer. Another question... Hello,.

I was looking for a way to display (product) images in their original.

Proportions (especially the smaller ones). And, came up with this.

"solution". Just add the following code to.

<your-path-to-osc>/catalog/includes/functions/html_output.php..

Add this,.

   $calculate_image_proportion = 'true';  //can possibly be substituted.

With CONFIG_CALCULATE_IMAGE_SIZE.

   if( ($calculate_image_proportion == 'true') && (!empty($width) &&.

!empty($height))) {.

     if ($image_size = @getimagesize($src)) {.

       $image_width = $image_size[0];.

       $image_height = $image_size[1];.

     $whfactor = $image_width/$image_height;.

     $hwfactor = $image_height/$image_width;.

       if ( !($image_width > $width) && !($image_height > $height)) {.

         $width = $image_width;.

         $height = $image_height;.

       } elseif ( ($image_width > $width) && !($image_height >.

$height)) {.

         $height = $width * $hwfactor;.

       } elseif ( !($image_width > $width) && ($image_height >.

$height)) {.

         $width = $height * $whfactor;.

       } elseif ( ($image_width > $width) && ($image_height > $height)).

{.

         if ($image_width > $image_height) {.

           $height = $width * $hwfactor;.

         } else {.

           $width = $height * $whfactor;.

         }.

       }.

     }.

   }.

Immediately below this existing code (approx. line 85),.

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) ||.

Empty($height)) ) {.

     if ($image_size = @getimagesize($src)) {.

       if (empty($width) && tep_not_null($height)) {.

         $ratio = $height / $image_size[1];.

         $width = $image_size[0] * $ratio;.

       } elseif (tep_not_null($width) && empty($height)) {.

         $ratio = $width / $image_size[0];.

         $height = $image_size[1] * $ratio;.

       } elseif (empty($width) && empty($height)) {.

         $width = $image_size[0];.

         $height = $image_size[1];.

       }.

     } elseif (IMAGE_REQUIRED == 'false') {.

       return false;.

     }.

   }.

By default, the images stretch/shrink according to the specified image.

Sizes (the standard ones set at admin). And, turning the admin setting.

"Calculate image size" on doesn't seem to work either. I have a lot of.

Small product images in my site, and adding this code helps maintain.

Their "right" proportions. You can have a look at my site.

Http://www.salehut.com.

(under development) where I've implemented.

This code..

Also try changing the image table cell alignments (for the "New.

Products" content box) to make smaller images look better aligned. Just.

Change the cell alignment parameter (align and valign) values, in the.

Following code in.

<your-path-to-osc>/catalog/includes/modules/new_products.php..

(somewhere around line 30).

   $info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' =>.

'class="smallText" width="33%" valign="bottom"',.

                                          'text' => '<a href="' ..

Tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' ..

$new_products['products_id'])'">'tep_image(DIR_WS_IMAGES ..

$new_products['products_image'], $new_products['products_name'],.

SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)'</a><br><a href="' ..

Tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' ..

$new_products['products_id'])'">'$new_products['products_name'] ..

'</a><br>'$currencies->display_price($new_products['products_price'],.

Tep_get_tax_rate($new_products['products_tax_class_id'])));.

Hope you find this useful.

..

Hey, and thanks all you gurus for all the great tips on this forum. I'm.

Fairly new to OSC and love the way this whole thing works..

Cheers,.

VJ..

Comments (87)

Yup, but you might wanna make sure and wait for another member here to confirm this as I am unsure. Better yet, why don't you email the iPage guys because they can help better...

Comment #1

There's a minor difference in the behaviour of the code you'd suggested, Mattice. It maintains the original proportion as well as the original size of the image. In the earlier code (the one I'd posted), only the image proportion is maintained... the image is still resized to fit in the standard image dimensions (say 100 x 80). So, a larger image would be shrinked to fit the standard image size, with it's proportions still intact..

VJ..

Comment #2

Vijay.

I haven't tested your code but I believe you may need to add a test for pixel gifs. ie as they are 1 x 1 pixel images that are stretched in height or width. If they retain their original proportions they will show as a square of either 1 x 1 or whatever..

I think all you need to do is to add a test for $image_width or $image_height being greater than 1 pixel at the start of the code...

Comment #3

Yes Ian, that's a good point you've made. I guess the 1x1 pixel images that are supposed to stretch, use a different function -.

Tep_draw_separator().

However..

VJ..

Comment #4

Tep_draw_separator calls tep_image which is where I understood you suggest embedding your code???..

Comment #5

Oops, sorry I didn't look hard enough. I'll include the segment you'd suggested in the code. Thanks Ian...

Comment #6

I've been just setting the height.

Or.

Width value, according to which one I wanted to be constant for all the images..

It's been working fine for me. One of the few things that is atm. :cry:.

Am I missing something? Is this too simple?..

Comment #7

Yep, setting the height.

Or.

Widhth of the image works too. Its just that the changes are global when the code is included in the html output function itself..

VJ..

Comment #8

Here's an update to the code that prevents 1x1 pixel images to be constrained to proportions. Thanks Ian.

   $calculate_image_proportion = 'true';.

   if( ($calculate_image_proportion == 'true') && (!empty($width) && !empty($height))) {.

     if ($image_size = @getimagesize($src)) {.

       $image_width = $image_size[0];.

       $image_height = $image_size[1];.

       if (($image_width != 1) && ($image_height != 1)) {.

         $whfactor = $image_width/$image_height;.

         $hwfactor = $image_height/$image_width;.

         if ( !($image_width > $width) && !($image_height > $height)) {.

           $width = $image_width;.

           $height = $image_height;.

         } elseif ( ($image_width > $width) && !($image_height > $height)) {.

           $height = $width * $hwfactor;.

         } elseif ( !($image_width > $width) && ($image_height > $height)) {.

           $width = $height * $whfactor;.

         } elseif ( ($image_width > $width) && ($image_height > $height)) {.

           if ($image_width > $image_height) {.

             $height = $width * $hwfactor;.

           } else {.

             $width = $height * $whfactor;.

           }.

         }.

       }.

     }.

   }.

VJ..

Comment #9

I was having fits with image proportions - just about to throw away the entire mess ...... just wanted to say thank you so much for this solution. It worked like a charm..

Comment #10

Thanks VJ for your excellent contribution.......was struggling with the solution to this problem for some time.....your code solved it straight away. Good work Fella !!..

Comment #11

Hello VJ,.

Perhaps this is not the right place for this post (which was posted.

In General support after which I saw this post).

But it is to do with the same problem of Image proportion..

I did implement your suggested code but it didn't.

Solve te problem described below..

Please note that I have set the image directory back.

To images/ as my iPage site is live and the images appear as normal.

+++++++++++++++++++++++++++++++.

I have this strange problem with the size of images.

When you set only the Image width to a positive.

Value and leave the Height as 0, all images are.

Automatically resized to the size without losing.

The proportion..

Someone suggested this in the forum and worked.

Great..

However calling the images from the http images.

Directory caused SECURITY warnings in shopping cart..

Setting the path of the Images directory to the HTTPS.

Server(wih the path provided by the ISP) seems to avoid this ..

But the images are only.

Appearing as a line (The height parameter which I had set to 0.

Is not calculated as before).

Please see.

Http://affiliatesexcel.com.

Is there a reason why the calculate image function.

Doesn't work ? .

++++++++++++++++++++++++++++++++++++++..

Comment #12

Can you make sure if.

Getimagesize($src).

In the tep_image() function (pls refer code below) actually returns.

True.

..

File: <your-osc-installation>/catalog/includes/functions/html_output.php.

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {.

     if ($image_size = @getimagesize($src)) {.

       if (empty($width) && tep_not_null($height)) {.

         $ratio = $height / $image_size[1];.

         $width = $image_size[0] * $ratio;.

       } elseif (tep_not_null($width) && empty($height)) {.

         $ratio = $width / $image_size[0];.

         $height = $image_size[1] * $ratio;.

       } elseif (empty($width) && empty($height)) {.

         $width = $image_size[0];.

         $height = $image_size[1];.

       }.

     } elseif (IMAGE_REQUIRED == 'false') {.

       return false;.

     }.

   }.

Its only a *wild guess*, and I haven't worked with secure servers too much. But, I *think* the image source ($src) might be inaccessible to the getimagesize() function, which makes it return a.

False.

, bypassing the image proportioning code, and the height remains 0, resulting in a "line"..

Hope this helps,.

VJ.

Http://www.salehut.com..

Comment #13

Hey great tip... goes well with the image resizer I am using....

One quick question... would this also work in admin?.

I've tried placing the code in admins html_output in the tep_image function, but the images are still stretched... I haven't looked really closely so maybe there is a variable or something that needs changed for admin...

Comment #14

Hi,.

A quick comparison of.

Tep_image().

Functions at.

Admin/includes/functions/html_output.php.

And.

Catalog/includes/functions/html_output.php.

Suggests that images are rendered quite differently by these 2 functions. So, the image proportion tweak won't likely work out-of-the-box in admin..

Hope this helps.

,.

VJ..

Comment #15

I have it working in admin... nothing in the new code needed changed....

It was.

Getimagesize.

, which works in the catalog, but doesn't seem to work in the admin...

Comment #16

:oops: Can you please post the code that now works for the admin..

I had a closer look today, and found that admin images (the product/category ones) use a different function.

Tep_info_image().

From the rest, which in turn uses a different image source path. But, I still couldn't figure out why the.

Getimagesize.

Function doesn't work. :shock:.

VJ..

Comment #17

I'm not sure what snapshot you're on but I don't have.

Tep_info_image().

In mine. I'm on 5/18/03 shot..

The admin is the same code as the catalog side for the change, I just commented out the.

If ($image_size = getimagesize($src)).

Surrounding it..

This is what my admin tep_image function looked like before:.

////.

// The HTML image wrapper function.

 function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {.

   $image = '<img src="'$src'" border="0" alt="'$alt'"';.

   if ($alt) {.

     $image .= ' title=" '$alt' "';.

   }.

   if ($width) {.

     $image .= ' width="'$width'"';.

   }.

   if ($height) {.

     $image .= ' height="'$height'"';.

   }.

   if ($params) {.

     $image .= ' '$params;.

   }.

   $image .= '>';.

   return $image;.

 }.

Then immediately after the.

Function tep_image(.

Line, I placed the code, before the $image starts:.

   $calculate_image_proportion = 'true';.

   if( ($calculate_image_proportion == 'true') && (!empty($width) && !empty($height))) {.

//      if ($image_size = getimagesize($src)) {.

 $image_size = @getimagesize($src);.

       $image_width = $image_size[0];.

       $image_height = $image_size[1];.

       if (($image_width != 1) && ($image_height != 1)) {.

  if (($image_width != 0) && ($image_height != 0)) {.

         $whfactor = $image_width/$image_height;.

         $hwfactor = $image_height/$image_width;      .

  }.

         if ( !($image_width > $width) && !($image_height > $height)) {.

           $width = $image_width;.

           $height = $image_height;.

         } elseif ( ($image_width > $width) && !($image_height > $height)) {.

           $height = $width * $hwfactor;.

         } elseif ( !($image_width > $width) && ($image_height > $height)) {.

           $width = $height * $whfactor;.

         } elseif ( ($image_width > $width) && ($image_height > $height)) {.

           if ($image_width > $image_height) {.

             $height = $width * $hwfactor;.

           } else {.

             $width = $height * $whfactor;.

           }.

         }.

       }.

//      }.

   }.

Same as catalog side, I just commented out the if getimagesize tags. You can try uncommenting them and see if getimagesize works for you in admin... I'm still trying to find out why it doesn't work in my admin, but commenting it out works until I can figure it out...

Comment #18

Hi,.

I'm on a 2.2 MS1 release..

I had a close look at your code hack, and managed to simulate the same behaviour by adding this code, instead of the image proportion code..

 function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {.

   $width = false; //VJ added.

   $height = false; //VJ added.

   $image = '<img src="'$src'" border="0" alt="'$alt'"';.

   if ($alt) {.

     $image .= ' title=" '$alt' "';.

   }.

   if ($width) {.

     $image .= ' width="'$width'"';.

   }.

   if ($height) {.

     $image .= ' height="'$height'"';.

   }.

   if ($params) {.

     $image .= ' '$params;.

   }.

   $image .= '>';.

   return $image;.

 }.

It displays the image in it's original proportion as well as in.

Original size.

And, I believe this is most likely to conflict with the spacer images, making them impotent..

VJ..

Comment #19

Hello,.

I was looking for a way to display (product) images in their original.

Proportions (especially the smaller ones). And, came up with this.

"solution". Just add the following code to.

<your-path-to-osc>/catalog/includes/functions/html_output.php..

Add this,.

   $calculate_image_proportion = 'true';  //can possibly be substituted.

With CONFIG_CALCULATE_IMAGE_SIZE.

   if( ($calculate_image_proportion == 'true') && (!empty($width) &&.

!empty($height))) {.

     if ($image_size = @getimagesize($src)) {.

       $image_width = $image_size[0];.

       $image_height = $image_size[1];.

     $whfactor = $image_width/$image_height;.

     $hwfactor = $image_height/$image_width;.

       if ( !($image_width > $width) && !($image_height > $height)) {.

         $width = $image_width;.

         $height = $image_height;.

       } elseif ( ($image_width > $width) && !($image_height >.

$height)) {.

         $height = $width * $hwfactor;.

       } elseif ( !($image_width > $width) && ($image_height >.

$height)) {.

         $width = $height * $whfactor;.

       } elseif ( ($image_width > $width) && ($image_height > $height)).

{.

         if ($image_width > $image_height) {.

           $height = $width * $hwfactor;.

         } else {.

           $width = $height * $whfactor;.

         }.

       }.

     }.

   }.

Immediately below this existing code (approx. line 85),.

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) ||.

Empty($height)) ) {.

     if ($image_size = @getimagesize($src)) {.

       if (empty($width) && tep_not_null($height)) {.

         $ratio = $height / $image_size[1];.

         $width = $image_size[0] * $ratio;.

       } elseif (tep_not_null($width) && empty($height)) {.

         $ratio = $width / $image_size[0];.

         $height = $image_size[1] * $ratio;.

       } elseif (empty($width) && empty($height)) {.

         $width = $image_size[0];.

         $height = $image_size[1];.

       }.

     } elseif (IMAGE_REQUIRED == 'false') {.

       return false;.

     }.

   }.

By default, the images stretch/shrink according to the specified image.

Sizes (the standard ones set at admin). And, turning the admin setting.

"Calculate image size" on doesn't seem to work either. I have a lot of.

Small product images in my site, and adding this code helps maintain.

Their "right" proportions. You can have a look at my site.

Http://www.salehut.com.

(under development) where I've implemented.

This code..

Also try changing the image table cell alignments (for the "New.

Products" content box) to make smaller images look better aligned. Just.

Change the cell alignment parameter (align and valign) values, in the.

Following code in.

<your-path-to-osc>/catalog/includes/modules/new_products.php..

(somewhere around line 30).

   $info_box_contents[$row][$col] = array('align' => 'center',.

                                          'params' =>.

'class="smallText" width="33%" valign="bottom"',.

                                          'text' => '<a href="' ..

Tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' ..

$new_products['products_id'])'">'tep_image(DIR_WS_IMAGES ..

$new_products['products_image'], $new_products['products_name'],.

SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)'</a><br><a href="' ..

Tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' ..

$new_products['products_id'])'">'$new_products['products_name'] ..

'</a><br>'$currencies->display_price($new_products['products_price'],.

Tep_get_tax_rate($new_products['products_tax_class_id'])));.

Hope you find this useful.

..

Hey, and thanks all you gurus for all the great tips on this forum. I'm.

Fairly new to OSC and love the way this whole thing works..

Cheers,.

VJ..

Comment #20

If you don't need the actual proportions all the time / don't like the overkill you can achieve the same principle by removing the image width and height from the tep_image() call in a specific page..

So the code.

Tep_image(DIR_WS_IMAGES$new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT).

Becomes:.

Tep_image(DIR_WS_IMAGES$new_products['products_image'], $new_products['products_name'], '', '').

Mattice..

Comment #21

Hello Jeff,.

I didn't think so too! :-).

I was just trying to bring out the difference between the 2 procedures, the code hack, and the admin change. You're right, the admin change works fine for images that aren't extrordinarily narrow or short. Its easier to apply too. As a matter of fact, I made this code hack just to get those extremely narrow candlestand images to show right, at one of the sites I was working on..

Not yet. I first have to make sure that this code hack works right, though. I'm sure the developers would have noticed all these image proportioning hacks. Yes, maybe they should consider including an image proportioning code in the standard code, unless there's any reason not to..

Thank you,.

VJ..

Comment #22

I just wanted to say thanks to you and everyone who spends the time working on making OS Commerce available, customizable and functioning for those of us who are code impared! You guys rock!..

Comment #23

WHAT WAS THE FIX FOR PICMAN. I TRIED TO ADD THE CODE BUT GET -Parse error: parse error, unexpected T_STRING in /usr/local/psa/home/vhosts/okie-sales.com/httpdocs/catalog/includes/functions/html_output.php on line 104.

Fatal error: Call to undefined function: tep_image() in /usr/local/psa/home/vhosts/okie-sales.com/httpdocs/catalog/includes/header.php on line 53.

- AFTER I TOOK THE CODE BACK OUT????..

Comment #24

Can you please post your solution here... just curious to know what exactly went wrong..

VJ..

Comment #25

I'm still looking for a way to fix the manufacturers images stretching my right column too big. Do I manually have to resize every image? Or are there any known hacks out there. Please help!..

Comment #26

I haven't used manufacturer images before, but here's a fix that might work..

In file /catalog/includes/boxes/manufacturer_info.php,.

Replace,.

     if (tep_not_null($manufacturer['manufacturers_image'])) $manufacturer_info_string .= '<tr><td align="center" class="infoBoxContents" colspan="2">'tep_image(DIR_WS_IMAGES$manufacturer['manufacturers_image'], $manufacturer['manufacturers_name'])'</td></tr>';.

With,.

     if (tep_not_null($manufacturer['manufacturers_image'])) $manufacturer_info_string .= '<tr><td align="center" class="infoBoxContents" colspan="2">'tep_image(DIR_WS_IMAGES$manufacturer['manufacturers_image'], $manufacturer['manufacturers_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)'</td></tr>';.

You might also want to apply some image proportioning code (this thread discusses it too!) to make the image display right..

HTH,.

VJ..

Comment #27

Thanx for the tip/hack. I'll try it this weekend and keep you guys posted if it works. They should let you be able to control the images in admin though, don't you think?..

Comment #28

Hi,.

I am a new user of Os Commerc 2.2, and it is the first web iPage site I do in my life....

I installed easy php on my computer and discovered the joy oh PHP, MySql and other stuffs....

After a lot and long nights of brainstorming I finally was able to make the iPage website on my local machine, and then transfer it on the web server..

Here is the result:.

Http://www.accessland.fr.

I have a lot of work to do on it now, but things are going well..

With this post I was able to make the resized images ratio Ok and so I would like to thank you a lot..

The only function that does not work on the web iPage site is that in admin I can not see the images of the productss, but on the other hand uploads and mages works fine on the catalog..

I must have made a few errors in the configure.php but I will work aroud this later, as I can start to work now on the content and the design and colors of the website....

So thanks a lot for all the help I could find on the forum and on your most, now I just have to find how to have a more friendly menu on the left, but I am sure that if I search in the forum I will find something...

Anyway, you all made a great job, and for me that does not know php language at all, it was a pleasure to make my first web iPage site with OS Commerce !!.

See ya guys,.

Fabien Deregel.

( FRANCE)..

Comment #29

Hi VJ, Thanks for the contribution!.

I am trying to use your code on the my php file, but every time I paste your code as suggested on the first post of this thread I am getting parse errors and the iPage site won't show anything (except for the errors of course)..

My file version is probably newer than the one you used, so maybe that's the reason. This is the code in my file:.

<?php.

/*.

 $Id: html_output.php,v 1.56 2003/07/09 01:15:48 hpdl Exp $.

 osCommerce, Open Source E-Commerce Solutions.

 http://www.oscommerce.com.

 Copyright (c) 2003 osCommerce.

 Released under the GNU General Public License.

*/.

////.

// The HTML href link wrapper function.

 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {.

   global $request_type, $session_started, $SID;.

   if (!tep_not_null($page)) {.

     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the page link!<br><br>');.

   }.

   if ($connection == 'NONSSL') {.

     $link = HTTP_SERVERDIR_WS_HTTP_CATALOG;.

   } elseif ($connection == 'SSL') {.

     if (ENABLE_SSL == true) {.

       $link = HTTPS_SERVERDIR_WS_HTTPS_CATALOG;.

     } else {.

       $link = HTTP_SERVERDIR_WS_HTTP_CATALOG;.

     }.

   } else {.

     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine connection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');.

   }.

   if (tep_not_null($parameters)) {.

     $link .= $page'?'tep_output_string($parameters);.

     $separator = '&';.

   } else {.

     $link .= $page;.

     $separator = '?';.

   }.

   while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);.

// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined.

   if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {.

     if (tep_not_null($SID)) {.

       $_sid = $SID;.

     } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == true) ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {.

       if (HTTP_COOKIE_DOMAIN != HTTPS_COOKIE_DOMAIN) {.

         $_sid = tep_session_name()'='tep_session_id();.

       }.

     }.

   }.

   if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {.

     while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);.

     $link = str_replace('?', '/', $link);.

     $link = str_replace('&', '/', $link);.

     $link = str_replace('=', '/', $link);.

     $separator = '?';.

   }.

   if (isset($_sid)) {.

     $link .= $separator$_sid;.

   }.

   return $link;.

 }.

////.

// The HTML image wrapper function.

 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {.

   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {.

     return false;.

   }.

// alt is added to the img tag even if it is null to prevent browsers from outputting.

// the image filename as default.

   $image = '<img src="'tep_output_string($src)'" border="0" alt="'tep_output_string($alt)'"';.

   if (tep_not_null($alt)) {.

     $image .= ' title=" 'tep_output_string($alt)' "';.

   }.

   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {.

     if ($image_size = @getimagesize($src)) {.

       if (empty($width) && tep_not_null($height)) {.

         $ratio = $height / $image_size[1];.

         $width = $image_size[0] * $ratio;.

       } elseif (tep_not_null($width) && empty($height)) {.

         $ratio = $width / $image_size[0];.

         $height = $image_size[1] * $ratio;.

       } elseif (empty($width) && empty($height)) {.

         $width = $image_size[0];.

         $height = $image_size[1];.

       }.

     } elseif (IMAGE_REQUIRED == 'false') {.

       return false;.

     }.

   }.

   if (tep_not_null($width) && tep_not_null($height)) {.

     $image .= ' width="'tep_output_string($width)'" height="'tep_output_string($height)'"';.

   }.

   if (tep_not_null($parameters)) $image .= ' '$parameters;.

   $image .= '>';.

   return $image;.

 }.

////.

// The HTML form submit button wrapper function.

// Outputs a button in the selected language.

 function tep_image_submit($image, $alt = '', $parameters = '') {.

   global $language;.

   $image_submit = '<input type="image" src="'tep_output_string(DIR_WS_LANGUAGES$language'/images/buttons/'$image)'" border="0" alt="'tep_output_string($alt)'"';.

   if (tep_not_null($alt)) $image_submit .= ' title=" 'tep_output_string($alt)' "';.

   if (tep_not_null($parameters)) $image_submit .= ' '$parameters;.

   $image_submit .= '>';.

   return $image_submit;.

 }.

////.

// Output a function button in the selected language.

 function tep_image_button($image, $alt = '', $parameters = '') {.

   global $language;.

   return tep_image(DIR_WS_LANGUAGES$language'/images/buttons/'$image, $alt, '', '', $parameters);.

 }.

////.

// Output a separator either through whitespace, or with an image.

 function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {.

   return tep_image(DIR_WS_IMAGES$image, '', $width, $height);.

 }.

////.

// Output a form.

 function tep_draw_form($name, $action, $method = 'post', $parameters = '') {.

   $form = '<form name="'tep_output_string($name)'" action="'tep_output_string($action)'" method="'tep_output_string($method)'"';.

   if (tep_not_null($parameters)) $form .= ' '$parameters;.

   $form .= '>';.

   return $form;.

 }.

////.

// Output a form input field.

 function tep_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {.

   $field = '<input type="'tep_output_string($type)'" name="'tep_output_string($name)'"';.

   if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {.

     $field .= ' value="'tep_output_string(stripslashes($GLOBALS[$name]))'"';.

   } elseif (tep_not_null($value)) {.

     $field .= ' value="'tep_output_string($value)'"';.

   }.

   if (tep_not_null($parameters)) $field .= ' '$parameters;.

   $field .= '>';.

   return $field;.

 }.

////.

// Output a form password field.

 function tep_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {.

   return tep_draw_input_field($name, $value, $parameters, 'password', false);.

 }.

////.

// Output a selection field - alias function for tep_draw_checkbox_field() and tep_draw_radio_field().

 function tep_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {.

   $selection = '<input type="'tep_output_string($type)'" name="'tep_output_string($name)'"';.

   if (tep_not_null($value)) $selection .= ' value="'tep_output_string($value)'"';.

   if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {.

     $selection .= ' CHECKED';.

   }.

   if (tep_not_null($parameters)) $selection .= ' '$parameters;.

   $selection .= '>';.

   return $selection;.

 }.

////.

// Output a form checkbox field.

 function tep_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {.

   return tep_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);.

 }.

////.

// Output a form radio field.

 function tep_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {.

   return tep_draw_selection_field($name, 'radio', $value, $checked, $parameters);.

 }.

////.

// Output a form textarea field.

 function tep_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {.

   $field = '<textarea name="'tep_output_string($name)'" wrap="'tep_output_string($wrap)'" cols="'tep_output_string($width)'" rows="'tep_output_string($height)'"';.

   if (tep_not_null($parameters)) $field .= ' '$parameters;.

   $field .= '>';.

   if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {.

     $field .= stripslashes($GLOBALS[$name]);.

   } elseif (tep_not_null($text)) {.

     $field .= $text;.

   }.

   $field .= '</textarea>';.

   return $field;.

 }.

////.

// Output a form hidden field.

 function tep_draw_hidden_field($name, $value = '', $parameters = '') {.

   $field = '<input type="hidden" name="'tep_output_string($name)'"';.

   if (tep_not_null($value)) {.

     $field .= ' value="'tep_output_string($value)'"';.

   } elseif (isset($GLOBALS[$name])) {.

     $field .= ' value="'tep_output_string(stripslashes($GLOBALS[$name]))'"';.

   }.

   if (tep_not_null($parameters)) $field .= ' '$parameters;.

   $field .= '>';.

   return $field;.

 }.

////.

// Hide form elements.

 function tep_hide_session_id() {.

   global $session_started, $SID;.

   if (($session_started == true) && tep_not_null($SID)) {.

     return tep_draw_hidden_field(tep_session_name(), tep_session_id());.

   }.

 }.

////.

// Output a form pull down menu.

 function tep_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {.

   $field = '<select name="'tep_output_string($name)'"';.

   if (tep_not_null($parameters)) $field .= ' '$parameters;.

   $field .= '>';.

   if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);.

   for ($i=0, $n=sizeof($values); $i<$n; $i++) {.

     $field .= '<option value="'tep_output_string($values[$i]['id'])'"';.

     if ($default == $values[$i]['id']) {.

       $field .= ' SELECTED';.

     }.

     $field .= '>'tep_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => ''', '<' => '&lt;', '>' => '&gt;'))'</option>';.

   }.

   $field .= '</select>';.

   if ($required == true) $field .= TEXT_FIELD_REQUIRED;.

   return $field;.

 }.

////.

// Creates a pull-down list of countries.

 function tep_get_country_list($name, $selected = '', $parameters = '') {.

   $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));.

   $countries = tep_get_countries();.

   for ($i=0, $n=sizeof($countries); $i<$n; $i++) {.

     $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);.

   }.

   return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters);.

 }.

?>.

How can I make it work on this version of the html_output.php file?.

Thanks in advance!..

Comment #30


This question was taken from a support group/message board and re-posted here so others can learn from it.