Jump to content
Sign in to follow this  
tobz

[Contribution] Additional Images for MS2

Recommended Posts

Hi all,

 

I looking to implement the attitional images in the same way the "More_Pics_6 for 2.2 ms2" http://www.oscommerce.com/community/contributions,1611 implemented theirs...

 

and I need some help...

 

The additional images works in a way that the script search the table "additional_images", and displays all the small images in the products_info.php

 

What it does now:

Clicking on the small image, "popup_images.php" a window with the larger image opens.

 

What I need to do

When the window is open instead of showing only the big image, I would like to show all the small images too. When I click on any small image in the popup window, the big will change to that clicked.

 

I have tried but I get always error. Unfortunatelly, the More_Pics_6 works in different way and I can't follow it..

 

Thanks for any help

 

Salvo

 

PS: one VERY GOOD example is

Gallery integrated http://www.oscommerce.com/community/contributions,1171

 

I like ti very much, but it doesn't use a table to for the images... I would like to do the same with ADDITIONAL IMAGES

Edited by Salvo

Share this post


Link to post
Share on other sites

Hi all

 

Anybody want to help in achieving this with additional image contribution?

Share this post


Link to post
Share on other sites

I got it all working... and for those in the thread that were wondering about having image resize with it, I do... using IMAGEMAGICK...

 

What I do have a problem with is that when I try to add a "pop-up" image, I don't get anything... I can only see the mini-image in the catalog, but when I try to click on it to get the bigger image, I get nothing... I had it one point I belive, but I didn't change any code and now it's gone.... any suggestions?

 

Thanks so much!

Edited by Stormlifter

Share this post


Link to post
Share on other sites

Something I discovered>> is that if I delete the table 'products_image_pop' and then recreate it and don't specify a popup image, then it'll work, but of course only display a larger version of the product image. As soon as I try to specify a popup image again the popup image doesn't come up at all not even the way it did before I deleted and created the table...

 

This is very odd... Please help ;) lol....

Share this post


Link to post
Share on other sites

Hi,

 

I just implemented this contribution. all's working well, except when i add additional images, and i got the following error message in my products page.

 

Fatal error: Cannot instantiate non-existent class: imagesbox in /home/estrella/public_html/includes/modules/additional_images.php on line 43

 

HELP? ;)

 

other than this, its a fantastic script! :D


You live, you learn. :)

Share this post


Link to post
Share on other sites

Hi, I'm aout to install this contrib as its just what i need. However, I'd like to be able to stop th images popping up in a new window. What I really need is for the images to be displayed on the main page and to be replaced when the user clicks on the thumbnail

Share this post


Link to post
Share on other sites

I have just installed this contribution....again!.

 

Although everything works ok, there is one small problem with the original thumbnail image. i cannot get it to display in the pop-up window.

All I get is the nefarious lil red "X"

 

The additonal image popups work fine...just not the original thumbs pop-up.

It DID work properly prior to installing the mod.


If it looks like a dog, smells like a dog and barks like a dog ... then it's probably a cat trying to sell you something. (?2003 R. Ellison)

 

Independence is the privilege of a mature mind ... not a toy for children to play with.

Share this post


Link to post
Share on other sites

OK...here's what i found, although I don;t know how to fix it.

When you right-click the red x and view its properties, it is showing the image as DIR_FS_CATALOG_IMAGES_BIGimagename

This tells me that the "big" images folder is not defined. Going over the files for this contrib, I can find nowhere where it IS defined...so I added a definition for this directory to configure.php

Now, right-clicking the little red x shows the iamges name as the name that was assigned to it when you add a name for the additional image, which is not necessarily the same as the images name, and without an extension.

You can work around this by giving your extra image the same name as the original images large pop-up image name. but it seems to me that this is not a very suitable resolution to the problem.

 

Don't know where to go with this...just letting you know what I found.


If it looks like a dog, smells like a dog and barks like a dog ... then it's probably a cat trying to sell you something. (?2003 R. Ellison)

 

Independence is the privilege of a mature mind ... not a toy for children to play with.

Share this post


Link to post
Share on other sites

Hello,

 

I am getting error after installation of "Additional Images" mod.

 

The error is:

 

-------

Fatal error: Cannot instantiate non-existent class: imagesbox in /wwwroot/shopping/includes/modules/additional_images.php on line 43

-------

 

Line #43 in file is:

 

new imagesBox ($info_box_contents);

 

 

I have seem somebody else also had the same error before but no exact/direct solution was posted anywhere in this forum.

 

What did I do wrong? Please help.

 

Thanks.


Everything is possible.

Share this post


Link to post
Share on other sites

Hello to all;

 

After to install the More_pics_6 contribution the page product_info.php always leaves to me in white without errors. Anybody knows what I am making bad? Use OSC v2.2 ms2 and Windows 2003 with php 4.3.8 Thanks.

Share this post


Link to post
Share on other sites
Line #43 in file is:

 

new imagesBox ($info_box_contents);

I have seem somebody else also had the same error before but no exact/direct solution was posted anywhere in this forum.

 

What did I do wrong? Please help.

 

Thanks.

 

Seems to me that you have forgot to install

class imagesBox extends tableBox

It should bee in catalog/includes/classes/boxes.php

 

HelloMan

Edited by HelloMan

Share this post


Link to post
Share on other sites

Hi all,

 

I've been using Additional Images for many months now successfully. However, today I ran into a problem. I have two products that share images, because they are two sizes of the same necklace. I removed the Additional Image on one, and the image disappeared on the other, which I feared would happen. When I tried to replace it, no file would be uploaded. In fact, now I cannot upload additional images at all! The dialogue boxes appear correctly, and I get all the way to the Save button, but then the errors (in pink) "Warning: No file uploaded" and "Error: Additional images field is empty" appear, and the images never load. I tried renaming the original image and reloading it, then tried adding other images to other products, but nothing works. This contrib seems really hosed.

 

Any suggestion on what may be screwed up? It seems to be in the database end, no?

 

Thanks,

Susan

Share this post


Link to post
Share on other sites

Has anyone been able to get this to work on a shop with BTS installed? The code for the popup image doesn't exist in either shop. Also, if I had an image in admin, it says it is added but then doesn't display the name. Is this normal? No second image is being displayed so I'm thinking it is not.

 

Jack

Share this post


Link to post
Share on other sites

Sorry, but I've a little problem.

I've installed the contribution, I can add additional pictures normally into my control panel, but, when I try to display the product, I get follow error:

 

1054 - Unknown column 'medium_images' in 'field list'

SELECT additional_images_id, products_id, images_description, medium_images, popup_images FROM additional_images WHERE products_id = '36'

[TEP STOP]

 

How can I solve this problem?

Thank you in advance.

Share this post


Link to post
Share on other sites

I changed my site to work only in an 800 x 600 window. As a result, all product listings that have three additional images using this contribution causes the page to go way off by pushing it beyond the 800 width as it is displaying 3 images per row when there is only room for 2 images.

 

I don't want to change the alignment to vertical.

 

If anyone else is experiencing the same problem, here is a quick fix to reduce the images from 3 per row to 2 per row.

 

Open additional_images.php and find:

 

$col ++;

if ($col > 2) {

$col = 0;

$row ++;

 

Replace it with:

 

$col ++;

if ($col > 1) {

$col = 0;

$row ++;

Share this post


Link to post
Share on other sites
"Warning: No file uploaded" and "Error: Additional images field is empty"

I'm also having this problem with an install that was working fine until recently. I'm not able to save any changes to existing products, and it doesn't go to the "Preview" page like it used to. Any thoughts on what's causing this, and how to fix it?


"That's because it's fly soup, sir..."

Share this post


Link to post
Share on other sites
I'm also having this problem with an install that was working fine until recently.  I'm not able to save any changes to existing products, and it doesn't go to the "Preview" page like it used to.  Any thoughts on what's causing this, and how to fix it?

 

Not sure how I fixed it... I mucked around in the database for a while, and it didn't seem to do much. Oh, now I remember - I restored a previous version of the database, and that fixed it, but not sure what I did after that. Hope that helps a little!

 

Susan

Share this post


Link to post
Share on other sites
Not sure how I fixed it... I mucked around in the database for a while, and it didn't seem to do much. Oh, now I remember - I restored a previous version of the database, and that fixed it, but not sure what I did after that. Hope that helps a little!

Thanks for the reply, Susan...that didn't fix it for me, though. :( I restored an older version of the database, reapplied the SQL files in the contrib, and even re-C&Ped the code snippets from the readme file to make sure I didn't accidentally leave something out. It's still giving me the error, and I can't edit any existing products. <_<

 

I PMed another person who had the same problem and fixed it (but didn't post what the problem was!)...gonna see if she can shed any more light on this.

 

Thanks for the suggestion and taking the time to get back to me!


"That's because it's fly soup, sir..."

Share this post


Link to post
Share on other sites

The additional images contrib 1.12 "additional_images.sql" has a bad query which leaves out the medium_images field. Run this query:

 

DROP TABLE IF EXISTS additional_images;
CREATE TABLE additional_images (
 additional_images_id int(11) NOT NULL auto_increment,
 products_id int(11) NOT NULL default '0',
 images_description varchar(64) default NULL,
 medium_images varchar(64) default NULL,
 popup_images varchar(64) default NULL,
 PRIMARY KEY  (additional_images_id),
 KEY products_id (products_id)
);

:thumbsup:

 

Sorry, but I've a little problem.

I've installed the contribution, I can add additional pictures normally into my control panel, but, when I try to display the product, I get follow error:

 

1054 - Unknown column 'medium_images' in 'field list'

SELECT additional_images_id, products_id, images_description, medium_images, popup_images FROM additional_images WHERE products_id = '36'

[TEP STOP]

 

How can I solve this problem?

Thank you in advance.

Share this post


Link to post
Share on other sites

Hi,

 

Seems like I have posted my problem in an old thread for this contribution - was no activity there. Here I go again:-)

 

Have installed this module and it seems really nice from what I can hear of your experience with it, but it does not work for me. Had to remove it again temporarily, because I did not find any answers to my problems. Maybe if some of you could help me a little I could make it work? Lets try:-)

This is my situation:

I already had auto thumbnail on the fly installed.

After installing the additional image contribution, I have these problems that I need to sort out:

 

1. I am not allowed to add images already uploaded to my site. My uploaded pictures is in a folder on the rot of my site (www.kjolebutikken.com/bilder). Oscommerce is in another folder on the root of my site (www.kjolebutikken.com/oscdemo1). These pictures are uploaded in standard "pictures for internet" format. When I upload in my ftp I can choose between small, medium and large. I have tried to add all three sizes, but I am not allowed. Get no error messages, just nothing happens when I select a picture to add. However, I am allowed to select pictures from my pc, although I get the errormessage "No picture is uploaded. No picture is added", when I go back to see, the picture iss indeed added !!??!! How can I add already uploaded images from my serverspace? How can I get rid of the error message if I want to add picture directly from my pc?

 

2. When I click on "Click to enlarge" under the picture in product descriprion page, I only get one picture up, and thats the one selected as popup when on the create product page. I do not get a popupwindow with many pictures in it? I have added many images to each product, but where are they supposed to be seen???

 

3. When I delete an added image, I get this error message:

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php on line 134

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php on line 134

 

Warning: Cannot modify header information - headers already sent by (output started at /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php:134) in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/general.php on line 22

 

I would really like to make this lovely contribution work, so PLEASE help me guys!!!

 

Thank you all so much:-)

Best regards

Kjolebutikken


Best regards

Kjolebutikken

Share this post


Link to post
Share on other sites

I solved my problems 1 and 2 in my post above. Only problem left now is this errormessage that I get after deteting an added image. The image is beeing deteted though. Anybode seen this before???

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php on line 134

 

Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php on line 134

 

Warning: Cannot modify header information - headers already sent by (output started at /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/database.php:134) in /customers/kjolebutikken.com/kjolebutikken.com/httpd.www/oscdemo1/admin/includes/functions/general.php on line 22

 

 

Thanks

Kjolebutikken

Edited by kjolebutikken

Best regards

Kjolebutikken

Share this post


Link to post
Share on other sites

Sorry, thought I did fix this, but I didn't. Still also have this problem:

 

I am not allowed to add images already uploaded to my site. My uploaded pictures is in a folder on the rot of my site (www.kjolebutikken.com/bilder). Oscommerce is in another folder on the root of my site (www.kjolebutikken.com/oscdemo1). These pictures are uploaded in standard "pictures for internet" format. When I upload in my ftp I can choose between small, medium and large. I have tried to add all three sizes, but I am not allowed. Get no error messages, just nothing happens when I select a picture to add. However, I am allowed to select pictures from my pc, although I get the errormessage "No picture is uploaded. No picture is added", when I go back to see, the picture iss indeed added !!??!! How can I add already uploaded images from my serverspace? How can I get rid of the error message if I want to add picture directly from my pc?

 

Anybody who can help me?

 

Thanks:-)

Kjolebutikken


Best regards

Kjolebutikken

Share this post


Link to post
Share on other sites

Just a quick one..

 

Where it says admin/categories.php

 

find:-

case 'new_product_preview':
// copy image only if modified
	$products_image = new upload('products_image');
	$products_image->set_destination(DIR_FS_CATALOG_IMAGES);
	if ($products_image->parse() && $products_image->save()) {
	  $products_image_name = $products_image->filename;
	} else {
	  $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
	}
	break;

 

I dont have that as I have the image subdirectory contribution installed.

 

In its place I have:-

 

case 'new_product_preview':
// copy image only if modified
	$products_image = new upload('products_image');
// ************************* Image path modification starts below *************************
if (USE_REG_GLOBALS_PATCH == 'true') {
	link_post_variable('image_subdirectory'); // function included in the Register Globals Patch - functions/general.php
	link_post_variable('new_dir'); // function included in the Register Globals Patch - in functions/general.php
}

// Here we strip away any extra slashes the user may add to the subdirectory field and make sure there is a final /.

  $image_subdirectory = preg_replace('/\\\/', '/', $image_subdirectory); // in case someone mistakenly uses backward slashes, flip 'em around
  if ($image_subdirectory == '/') { ($image_subdirectory = ''); // in case the user mistakenly entered only a single /
	}
  if ($image_subdirectory != '') { // we want to add a path
	$image_subdirectory = preg_replace('/\/\/+/', '/', $image_subdirectory); // change any multiple slashes to a single /
	if (strpos($image_subdirectory, '/') === 0) { $image_subdirectory = substr($image_subdirectory, 1); // strip any leading slash
	}
	if (strrpos($image_subdirectory, '/') != (strlen($image_subdirectory) -1)) { $image_subdirectory = ($image_subdirectory . '/'); // add one slash at the end if there wasn't one.
	}
  } // End corrections of any user errors

// Create directory if requested (Box Checked, $new_dir == 'on?)
if ($new_dir == 'on') {
if (USE_UNIX_SLASHES == 'true') {
	$working_directory = DIR_FS_CATALOG_IMAGES . $image_subdirectory;
	if (USE_PHP5_MKDIR == 'true') {
	   if (!is_dir($working_directory)) { 
	   mkdir($working_directory, 0777, 1);
	   // chmod($working_directory, 0777); // Change to suit server needs, depending on directory owner
	   } 

	} else { // php4 mkdir recursion

		do {
		   $dir = $working_directory;

			while (!@mkdir($dir,0777)) {
				$dir = dirname($dir);
				if ($dir == '/' || is_dir($dir))
					break;
				}
		// chmod($dir, 0777); // Change to suit server needs, depending on directory owner
		} while ($dir != $working_directory);

		} 
	} else { // End unix mkdir routine

// Windows mkdir routine start
	$working_directory = DIR_FS_CATALOG_IMAGES . preg_replace('/\//', '\\', $image_subdirectory); // replaces forward slashes with backwards ones
	if (USE_PHP5_MKDIR == 'true') {
	   if (!is_dir($working_directory)) { 
	   mkdir($working_directory, 0777, 1); // the 0777 chmod arg. has no effect under Windows, left in for consistency
	   } 

	} else { // php4 mkdir recursion

		do {
		   $dir = $working_directory;
			while (!@mkdir($dir)) {
				$dir = dirname($dir);
				if ($dir == '\\' || is_dir($dir))
					break;
				}
		} while ($dir != $working_directory);

		} 
	}	// End Windows mkdir routine
}

	$products_image->set_destination(DIR_FS_CATALOG_IMAGES . $image_subdirectory ); // ***** append server image subdirectory
	if ($products_image->parse() && $products_image->save()) {
	  $products_image_name = $products_image->filename;
	  $products_image_name = $image_subdirectory . $products_image_name; // ***** Prepend subdirectory to filename
	} else {
	  $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');
	}
	 $products_image_pop = new upload('products_image_pop');
	$products_image_pop->set_destination(DIR_FS_CATALOG_IMAGES);
	if ($products_image_pop->parse() && $products_image_pop->save()) {
	  $products_image_pop_name = $products_image_pop->filename;
	} else {
	  $products_image_pop_name = (isset($HTTP_POST_VARS['products_previous_image_pop']) ? $HTTP_POST_VARS['products_previous_image_pop'] : '');
	}
	break;
}
 }

// ********** Image path modification ends here **********

 

I've added the code below to my code just after the last break before the two }} but that dosn't seam to work as when I add a standard image to my products they no loanger show..

 

case 'add_images':
	$products_id = $HTTP_GET_VARS['pID'];
	$add_images_error = true;
	if ($popup_images = new upload('popup_images', DIR_FS_CATALOG_IMAGES)) {
	  $add_images_error = false;
	  $sql_data_array = array('products_id' => tep_db_prepare_input($products_id),
							  'images_description' => tep_db_prepare_input($HTTP_POST_VARS['images_description']),
							  'popup_images' => tep_db_prepare_input($popup_images->filename));
	  $sql_data_array = array_merge($sql_data_array, $add_data_array);
	}
	if ($add_images_error == false) {
	  tep_db_perform(TABLE_ADDITIONAL_IMAGES, $sql_data_array);
	} else {
	  $messageStack->add_session(ERROR_ADDITIONAL_IMAGE_IS_EMPTY, 'error');
	}
	tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
	break;

  case 'del_images':
	$products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);
	if ( ($HTTP_GET_VARS['pID']) && (is_array($HTTP_POST_VARS['additional_images_id'])) ) {					   
	  $additional_images_id[] = tep_db_prepare_input($HTTP_POST_VARS['additional_images_id']);
	  for ($i=0; $i<sizeof($additional_images_id); $i++) {
//SECTION DELETE POPUP IMAGES
		$delimg_query = tep_db_query("select popup_images from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'");
		$delimg = tep_db_fetch_array($delimg_query);
		if (tep_not_null($delimg['popup_images']) && file_exists(DIR_FS_CATALOG_IMAGES.$delimg['popup_images']) )
			if (!unlink (DIR_FS_CATALOG_IMAGES.$delimg['popup_images']))
			   $messageStack->add_session(ERROR_DEL_IMG_XTRA.$delimg['popup_images'], 'error');
			else
			   $messageStack->add_session(SUCCESS_DEL_IMG_XTRA.$delimg['popup_images'], 'success');
//END OF SECTION DELETE POPUP IMAGES
		tep_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'");
	  }
	}
	tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));
	break;

 

Can anyone tell me if theres a way to integrate those two codes?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×