Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Added mo_pics v1.1, Now Can't Add Pics :(


Guest

Recommended Posts

So, here's the deal: I added the mo_pics v1.1 contribution to the 2002 09 20 snapshot, and everything seems to work, *EXCEPT* adding images. It accepts them, and puts the right name in the DB, but doesn't copy the actual file to the images directory.

 

Apparently the contribution was updated for version 1.133 of admin/categories.php, which is where the images are added; but my version was 1.137.

 

So, a couple of questions:

 

1- Where can I get a copy of the 1.133 version so I can make a comparison, and make appropriate changes to my version.

 

2- Is there anything else I can do to fix this?

 

Thanks,

Link to comment
Share on other sites

You can't have everything. That's why trains have difficulty crossing oceans, and hippos did not adapt to fly. -- from the OpenBSD mailinglist.

Link to comment
Share on other sites

Thanks a lot Jan.

 

Now for a stoopid question: If I have a product and a couple of images, how do I remove an image from the product definition? (So that it's cleared in the db)

 

Thanks,

Link to comment
Share on other sites

:(

Very high frustration level! Merged the categories.php 1.133 changes into 1.137, and it still won't copy files to the images directory. Switched back to the old version of 1.137, still no images... So now I'm thinking there may be something else that corrupted that behaviour.

 

It is categories.php that's supposed to copy the images to the images directory, yes?

 

Any assistance would be *extremely* welcome and appreciated!!!

 

Thanks,

Link to comment
Share on other sites

If you use catagories.php version 1.133 you will still have a problem perhaps... I did,a nyway.

 

All I had to do was to change every occurrance (there are 14) of "move (".

 

That solved the problem, now the images upload fine on changes.

Link to comment
Share on other sites

I apologize for being vague in what I posted a few moments ago, I did not preview it and it wasn't very clear...

 

I used the version 1.133 catagories.php that comes with the MoPics v.1.1 contribution as written by Brandon Sweet et al. even thought i have a later snapshot.

 

However, I had to change all of the occurrances of "move(" in that file to "copy(" in the catagories.php that Brandon sent. You will find 14 occurrances of this in the file. Why he used "move" instead of "copy" is unclear to me...

 

I did not try the "tep_copy_uploaded_file(" in the later distributions. (I am pragmatic.... if it works, use it!) I will see later about upgrading the other changes in my newer snapshot.

 

This resolved all of the problems with uploading new or modified images for me.

Link to comment
Share on other sites

Sorry Alfred, you are right. Thanks, and sorry! :oops:

 

You replace all the occurances in Brandons version 1.133 with "copy(" in the place of "move_uploaded_file(". I must be tired...! or old...! :roll:

 

I think the copy() function is part of PHP. The newer tep_copy_uploaded_file(") function is in later snapshots.

 

I did go ahead and upgrade Brandon's 1.133 version of catagories.php with all of the other differences in the newer 1.137 snapshot, but I left Brandon's code for the mopics alone. It all seems to work fine now, and should be easy to change later.

Link to comment
Share on other sites

Tried changing the move_uploaded_file() to copy(), and there *were* 14, as you predicted, but that still didn't solve the problem.

 

As I mentioned, I had tried reverting back to the original 1.137 version, and it still didn't work. It could be something else that's throwing a spanner in the works.

 

As I don't have a debugger that will work easily, I guess I'll have to track the variables through echoes or to a logfile. (Man do I miss Delphi!)

 

I'll keep you posted. And in the meantime, if you can think of anything, please let me know. Thanks for your help!

Link to comment
Share on other sites

So I added a couple of echoes in the action=new_product_preview (assuming that's where the images get copied to the images dir) and here's what I found...

 

The $products_image variable is supposed to be an array (according to admin/includes/functions/general.php tep_copy_uploaded_file()), but it's just a string. Furthermore, it's sometimes treated like a string and sometimes like an array... :?: What's up with that???

 

// copy image only if modified

 echo "<br>";

 echo "***AAA $products_image: '$products_image'<br>";

 echo "<pre>";

 print_r($products_image);

 echo "</pre>";

     if ( ($products_image != 'none') && ($products_image != '') ) {

       $image_location = DIR_FS_CATALOG_IMAGES . $products_image_name;

 echo "***AAA $image_location: '$image_location'<br>";

 echo "***AAA $image_directory: '$image_directory'<br>";

       if (file_exists($image_location)) @unlink($image_location);

       copy($products_image, $image_location);

       tep_copy_uploaded_file($products_image, $image_directory);

       $products_image_name = $products_image['name'];

     } else {

       $products_image_name = $HTTP_POST_VARS['products_previous_image'];

     }

 

Also, the $image_directory variable is an empty string. Doing a grep for it, I found it was only set in the banner_manager.php script.

 

Any comments on these findings are welcome...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...