Is it true that iPage host website...?

Click Here To View All Answers...

First question I got is Is it true that iPage host website...? Many thanks for any answer. Another quick question... The install of osc 2.2 on my server was smooth and easy. Thanks for the great script. There is one big problem and that is bandwidth usage. I checked my transfer and found I was using some big numbers just doing the install of the script.

My point is install this addon to make real thumbnails of pics. My iPage site loads about 20 times faster too now..

Automatic Thumbnail Script..

Comments (168)

Ye, but... you might wanna make sure and wait for someone else here to confirm my answer as I am not very confident. Better yet, why don't you email the iPage guys because they can give you help better...

Comment #1

Good advice.. I was just looking for this. Thanks a bunch..

Comment #2

I think I did everything fine, the images are showing thumbnails too... but I am getting this error on the top of page:.

My html_output.php page now after installing the contribution is as follows:.

Please can anyone suggest what I did wrong???.

This post has been edited by.

Christian Lescuyer.

: 17 December 2003, 11:31..

Comment #3

Delete the blank line(s) after the final "?>" at the very bottom of your file and hit save...

Comment #4

I just gave this a try but can't get it to work. I assumed that the directory imagecache would be created when needed but it never appeared. So I thought maybe I had to add it myself. But when I tried to create the directory I was not allowed to. I can create directories, it is just that name that it won't allow. I can create one called imagecachx, for example..

Also, I don't know if my host supports writing of gif's or not. I tried taking out the unsupported tag but my page would not display at all then. All of my images are gifs - does that mean this won't work for my site?.

Anyone have any idea where I might be making a mistake?.


Comment #5

I installed this mod following the directions verbatim, now when I go to my main catalog page, most of the page is not displayed, just the masthead and the categories and manufacturers menus on the left..

I am not sure whether or not my server has "Webspace has GIF read and write ability" - what exactly is being referred to there?.

It also seems as if the instructions went from step 5 to step 7, is step 6 missing?.

Many thanks for any help,.


Comment #6

Jack, the imagecache directory on mine was created when the script ran. Have to refresh ftp program to see new folder. I had a problem with the gif line also but I dont use them so I didnt bother to fix it. I will check and see I can get it to work...

Comment #7

Ok I got the gif thing to work..

Here is the old not working gif's:.

$types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp");.

$not_supported_formats = array ("GIF"); // Write in capital Letters!!.


!is_dir ($cachedir).

? mkdir ($cachedir, 0777).

: system ("chmod 0777 ".$cachedir);.

Here is the fixed:.

$types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp");.

!is_dir ($cachedir).

? mkdir ($cachedir, 0777).

: system ("chmod 0777 ".$cachedir);.

So basically take the second line out and leave no spaces..

This post has been edited by.


: 17 December 2003, 07:20..

Comment #8

This looks like a great modification, but I can't get it to work..

I've modified html_output.php, and checked for typos', there were none..

When I go to my shop's URL I get only a partial page and no images. I geta left hand column, a center box and the categories box. In the bottom border of the categories box I gat an error message in German (my iPage site is English only) "Fehlende® oder ungultiger® GroBenparameter!". When I check my logs, I see that the thumbnails are not being created in the cache cache directory even though the script created the cache directory with proper permissions..

I'm running MS2 with SEC2v2..

Can anyone tell me waht I need to do to get this working?.


Rick Knight..

Comment #9

I have installed the mod and no images are showing up like above - any ideas?.



This post has been edited by.


: 17 December 2003, 20:18..

Comment #10

Catdad...sounds like your cut and paste might have messed up the code. There are german error phrases there unfortunately. What do you guys use to cut and paste the code?..

Comment #11

I use Dreamweaver MX and get a totally blank page except for the left column and no errors..

On my test iPage site that has empty images it created the imagecache folder and no errors or problems but didn't work on this live iPage site where the images are showing up so must have something to do with that folder..

Imagecache folder has permissions of 777...

Comment #12


Thanks for your reply..

I used my HTML editor, Quanta, for editing the php files. I'll try again and see what I get. I'll post back here..

BTW. My high scool german is a bit rusty, can anyone here translate the error message?.


Rick Knight..

Comment #13

Thanks Chad,.

The translation is Missing or invalid size parameter..

Any ideas anyone?.


Rick Knight..

Comment #14

I installed the module and am having no problems. I did exactly as it was told in the contribution and got it right. Yes, the 6th step is missing and goes directly to 7th..

My imagecache folder was created autometicaly, I use Simple Notepad to edit the pages, or sometimes directly from cpanel..

You can check my iPage site here:.


I do not use GIF therefore I didnt bother to change that line..

Thats only the help I can give. Do you people want me to paste my working modified html_output.php page here???..

Comment #15

Here is my Complete Modified page which is working fine at my site:.


See if this helps!!!!..

Comment #16

The only problem I see with this mod is you dont have complete control over the quality of the thumbnail. I'd like to see the thumbnails of some stores that use this and see how they turned out...

Comment #17

Yogi...don't ever use notepad for code's just asking for trouble and cpanel is just as dangerous even though I do it with my vdeck admin. Here is my working code....I hate ya'll having trouble with this...I went step by step and it worked except the gif which I fixed in this post. Plus my bandwidth usage is only 3-4 megs during testing instead of 25-30..

Yogi I think it's notepad for you...look at the extra spaces you have all over the place. I use pfe32 to edit text...get it at kinda old but works great, love the auto backup feature for files when you edit! Here is my working code. here is my site....

My Store with this mod running.



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

OsCommerce, Open Source E-Commerce Solutions.


Copyright © 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') {.


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

If (ENABLE_SSL == true) {.


} else {.



} 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') ) ) {.


$_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;.


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


If ( ($width) || ($height) ) {.

If ( $width=="100%" ) {.

$width = $image_size[0];.

} elseif ( $height=="100%" ) {.

$height = $image_size[1];.

} elseif ( $width==0 ) {.


} elseif ( $height==0 ) {.



$src=thumbimage(DIR_FS_CATALOG'/' .$src, $width, $height, 1, 1, DIR_FS_CATALOG'/'DIR_WS_IMAGES'imagecache');.

If ((($image_size[1]/$height) > ($image_size[0]/$width) ) && $height>0){.

$width=ceil(($image_size[0]/$image_size[1])* $height);.

} elseif ($width>0) {.





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

Return '';.


// 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 (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);.


Function thumbimage ($image, $x, $y, $aspectratio, $resize, $cachedir){.


# - Thumbnail-Script v1.3 - #.

# Generating thumbnails 'on-the-fly' with PHP #.

# #.

# © by Christian Lamine, FlashDreams OHG #.




# #.

# Modified by.



# #.

# This script may be freely used, distributed #.

# and modified without any charge as long as #.

# this copyright information is included. #.

# #.

# Any commercial selling of this script is #.

# forbidden. #.

# #.

# The author is not responsible for possible #.

# damage which may result from the application #.

# of this script, neither direct nor indirect. #.

# Use at your own risk! #.



$types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp");.

!is_dir ($cachedir).

? mkdir ($cachedir, 0777).

: system ("chmod 0777 ".$cachedir);.

(!isset ($x) || ereg ('^[0-9]{1,}$', $x, $regs)) &&.

(!isset ($y) || ereg ('^[0-9]{1,}$', $y, $regs)) &&.

(isset ($x) || isset ($y)).

? true.

: DIE ('Fehlende® oder ungltige® Grenparameter!');.

!isset ($resize) || !ereg ('^[0|1]$', $resize, $regs).

? $resize = 0.

: $resize;.

!isset ($aspectratio) || !ereg ('^[0|1]$', $aspectratio, $regs).

? isset ($x) && isset ($y).

? $aspectratio = 1.

: $aspectratio = 0.

: $aspectratio;.

!isset ($image).

? DIE ('Es wurde kein Bild angegeben!').

: !file_exists($image).

? DIE ('Die angegebene Datei konnte nicht auf dem Server gefunden werden!').

: false;.

$imagedata = getimagesize($image);.

!$imagedata[2] || $imagedata[2] == 4 || $imagedata[2] == 5.

? DIE ('Bei der angegebenen Datei handelt es sich nicht um ein Bild!').

: false;.

$imgtype="!(ImageTypes() & IMG_"strtoupper($types[$imagedata[2]])")";.

If ((eval($imgtype)) || (in_array(strtoupper(array_pop(explode('.', basename($image)))),$not_supported_formats))) {.

$image = substr ($image, (strrpos (DIR_FS_CATALOG'/', '/'))+1);.

Return $image;.


If (!isset ($x)) $x = floor ($y * $imagedata[0] / $imagedata[1]);.

If (!isset ($y)) $y = floor ($x * $imagedata[1] / $imagedata[0]);.

If ($aspectratio && isset ($x) && isset ($y)) {.

If ((($imagedata[1]/$y) > ($imagedata[0]/$x) )){.

$x=ceil(($imagedata[0]/$imagedata[1])* $y);.

} else {.




$thumbfile = '/'basename($image);.

If (file_exists ($cachedir.$thumbfile)) {.

$thumbdata = getimagesize ($cachedir.$thumbfile);.

$thumbdata[0] == $x && $thumbdata[1] == $y.

? $iscached = true.

: $iscached = false;.

} else {.

$iscached = false;.


If (!$iscached) {.

($imagedata[0] > $x || $imagedata[1] > $y) || (($imagedata[0] < $x || $imagedata[1] < $y) && $resize).

? $makethumb = true.

: $makethumb = false;.

} else {.

$makethumb = false;.


If ($makethumb) {.

$image = call_user_func("imagecreatefrom".$types[$imagedata[2]], $image);.

$thumb = imagecreatetruecolor ($x, $y);.

Imagecopyresampled ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]);.

Call_user_func("image".$types[$imagedata[2]], $thumb, $cachedir.$thumbfile);.

Imagedestroy ($image);.

Imagedestroy ($thumb);.

$image = DIR_WS_IMAGES'imagecache'$thumbfile;.

} else {.


? $image = DIR_WS_IMAGES'imagecache'$thumbfile.

: $image = substr ($image, (strrpos (DIR_FS_CATALOG'/', '/'))+1);.


Return $image;.



Comment #18

Here is the bablefish translation of the error "Missing one or ungultiger rough parameter"..

Comment #19

Hey by chance did anyone get broken images with no errors script errors and try to right mouse then click "show picture". I think I had to do that to a few images to get the thumbnail created and working...

Comment #20

This script works for me. However I'm trying to install it on a site.

With more than a thousand items with frequent changes in them..

Unfortunately when a product is deleted in admin, the pics are not.

Deleted too. I'm not sure whether this is how OSC works. Both the.

Original pic and the thumbnail are not deleted. This makes it really.

Difficult to mange..

Any idea?..

Comment #21

Although the above post is valid, I'm sorry that I'm referring to the.

Wrong contribution. I'm using the Automatic Thumbnail Creator located.



Works great and the quality of the thumbnail is definable...

Comment #22

I've tried for the third time and I still can't get this addon to work. I've checked my code line by line and everything is correct, so I think it has to do with SEC2v2..

Has anyone been able to get this to work with SEC2v2? If so please post how you did it..


Rick Knight...

Comment #23

I tried your fix but still could not get it to run so I contacted my host to see if there was some setting they had to change. They asked to look at the code and then replied with.

"The problem lies with the script attempting to execute a cmd.exe within the.

Server. This isn't allowed because it's a security risk. The script is.

Making a call to C:\windows\system32\cmd.exe which the security settings on.

The server do not allow. I will not be able to grant access for this script.

To call that executable.".

Do you know what he's talking about. I don't see what is making this call. Is it the system function? I could remove that and set the permissions myself. Is this security risk he's talking about not monitored by other hosts? Any ideas on how to get this running given the above situation or if there is an alternative contribution?.


Comment #24

1. Yes, the system function. Replace.

!is_dir ($cachedir).

? mkdir ($cachedir, 0777).

: system ("chmod 0777 ".$cachedir);.


If ( !is_dir ($cachedir)) mkdir ($cachedir, 0777);.

2. MS application security rather blows. Other servers would not suffer from the same level of danger..

3. I'm not sure if this contribution will run on MS Windows or not, but the change in 1 will get you around the current problem. MS doesn't support chmod anyway, so even without the security concerns, that part wouldn't work as written. A more important problem would be if the GD libraries are not installed. I don't know if they are available for MS Windows or not..



Comment #25

Thanks for trying Matt. Still doesn't work. I sent your response to my host and they are tryingt o get it to work. They said they installed the libraries but werre unsure as to why the code wasn't working. They are a very helpful host though and also said that they will continue to work with it to try and sort it out. If they figure it out I'll post the solution here..


Comment #26


I'm trying to get Automatic Thumbnails (contribution 841) and Dynamic Mopics (contribution 1114) to work on ms2..

When I installed the automatic thumbnail creator, copied the html_output.php file over from the contrib, product info stopped working..

How can I check that the imagecache directory is being made, and that the thumbnails are being used from there?.

When I want to use Dynamic Mopics, then do I set the thumbs directory to the imagecache directory?.

Will this work with a directory structure such as images/products/manufacturer/image_filename for the large images?.

Thanks in advance..


Comment #27

To check imagecache files just use your ftp and take a look at the folder. I am also trying to add mopics and automatic thumbnail together. It works only problem is since the thumbnails are not created until the product listing is called I have to look at each picture first then add another one and look at it....kind of a pain..

Comment #28

Hey Frank, I'm dying to see your site, when we gonna have a sneek preview, or is it live somwhere else?..

Comment #29

You can see it but remember I have some big problems right now and this is all just trying to tweak everything out..

One problem is my host wont display my index.php file. So you may hit 404 errors and navigation strays off and the sale pitch on index.php is gone..

And two..basically the navigation is messed up! There are test products in mens and womens "shirts".

Scripts used:.

Osc ver2.2 ms2.

Auto Thumbnail, contib #1484.

Simple Template System Ver 1.8, contib #1524.

Dynamic Mopics, contib #1114.

My Webpage..

Comment #30

Plus using addon....Categories: Display only top categories, contrib #1145..

Comment #31

If ( !is_dir ($cachedir)) mkdir ($cachedir, 0777);.

Fix cool deal....

THANK YOU...check out my new post on swell shrink problem.

Woo hoo hahaha..

Comment #32

Yeah, get that shop up bud...I need some trendy shoes....

Nice pics...i been checkin them out..

Comment #33

The install of osc 2.2 on my server was smooth and easy. Thanks for the great script. There is one big problem and that is bandwidth usage. I checked my transfer and found I was using some big numbers just doing the install of the script. The problem is the script does not make thumbnails of the product images so everytime you load a page those little thumbs are actually transfering the full size image..

My point is install this addon to make real thumbnails of pics. My iPage site loads about 20 times faster too now..

Automatic Thumbnail Script..

Comment #34

Well that did it. My bandwidth usage is just a few megs now while I test the script. The old way without this thumbnail addon was 25-30 megs of transfer and now it's about 4megs. Plus the speed in which my iPage site loads in so much faster. If you don't have this addon...get it!..

Comment #35

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