Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problem when adding image.


ice-man

Recommended Posts

Posted

I'm trying to add an image to my item. The image is put inside a new folder under /images. (for example: /images/dvd/).

 

So I uploaded my pic, and in the "edit item" page, I entered "dvd/pic.jpg", but after I saved it, it always got truncated to just "pic.jpg". And therefore my image won't appear, since the img link is incorrect.

 

Is this a normal behavior, or is there something wrong?

 

THanks.

Posted

If you are uploading picture(s) when you set up a new item, there is a very easy way to get your path installed.

 

On your home computer put your images to upload in a directory of the same name as your subdirectory on the server.

 

example: you want a picture cat.jpg in images/cats/cat.jpg

on your computer, put the image in something like C:\myDocuments \MyPhotos\cats\cat.jpg

 

Then, when you specify the upload path in your Admin panel, change the upload path from "C:\myDocuments\MyPhotos\cats\cat.jpg" to "C:\myDocuments\MyPhotos\cats/cat.jpg"

 

This will upload cats.jpg to cats/cat.jpg, and put the path in your database.

 

hth

GEOTEX from Houston, TX

 

(George)

Posted

Hey Geotex,

 

THanks for the info, but it does not work for me. I followed your instruction, but it keeps uploading the image to the /images folder.

 

Any other ideas?

Posted

C:\myDocuments\MyPhotos\cats/cat.jpg

 

Make sure you

 

1. created the subdirectory you want the picture loaded to under your images directory, and have permissions for the directory set to 755 or 777.

 

2. change the backslash infront of your image to a forward slash in the listing in your admin panel new products page Products Image when you click on browse. You have to manually change that last \ to /

 

Just set this one up, click on the link and right click on the picture, then properties to see the path.

 

sample at sample

 

hth

GEOTEX from Houston, TX

 

(George)

Posted

I started having this problem sometime after 6/21 but we have not made any changes to the code, database, etc.

 

All of a sudden when adding or changing the image location for a product the directory name is stripped out and only the .jpg or .gif filename is stored. I have to go into the database and manually update the products record to include the directory name.

 

The process I have always used for adding/changing images is as follows: set the image location such as directory/image.jpg (if the product will be stored in a sub-directory of the main images directory on the server) or simply image.jpg (if the product's image will be in the main images directory). I then ftp the image over to the location I specified.

 

I have submitted a trouble ticket to our hosting provider to see if they have made any changes recently but if anyone else has experienced this and come up with a reason/solution please let me know.

 

Thanks!

Posted

My hosting provider just told me the only change they made since the last time I was able to manage images without this problem was to upgrade php from 4.3.6 to 4.3.7. Did anyone else make this upgrade right before the problem started? Or were there any other changes/upgrades on your database, server, etc.?

Posted

When they upgraded, they had to restart the server. Just on the outside chance that something did not retain properties, check your subdirectories under the image directory to make sure they are chmod 755 or 777. Probably not a cause, but right now, I don't know of another reason why you would not be able to do what was working, unless you added a contribution we don't know about.

GEOTEX from Houston, TX

 

(George)

Posted

777 for images (already checked that). That would have given an error message along the lines of "Permission Denied... unable to write..."

 

Anyways, the problem is that what is being stored in the db is just the image name even when I type in a directory and image name. There is no way to store the correct image location without going directly into phpmyadmin and manually updating the products table with the correct location.

 

No contributions, code changes or settings have been changed on my end (and I'm the only one that does them here).

 

This is really driving me nuts...

Posted
even when I type in a directory and image name.

 

I have never been able to get this to work. The only way I have ever been able to get the subdirectory to work is to pick the image using the browse function, and changing the \ to a / in front of the image.

 

I have also used phpMyAdmin and a text file generating a sql statement created in Excel to upload the info directly to the database when I had a few hundred images to upload.

GEOTEX from Houston, TX

 

(George)

Posted

By the way, i'm not talking about having osCommerce upload my images (never even bothered with that since it's easier for me to do a mass ftp over to the server). I'm only talking about storing the image path and filename in the image field in the products table. For example my images directory is called images and i ftp a picture over to images/subdir/image.jpg so i want subdir/image.jpg to be stored in the database. This worked perfectly at least through 6/21 which is the last day i added a new product to my store. What is happening since sometime after 6/21 is that only image.jpg gets stored and the system is tossing out the subdir/ portion of what i typed in, which i then have to manually add back to the field in phpmyadmin.

 

It should be noted that a long time ago i modified upload.php (pretty sure that's the one but it's been a while and i'm too tired to check right now) so it wouldn't keep writing 0 byte files when i added a new product or assigned the same image to multiple products.

 

Thanks!

  • 4 weeks later...
Posted

http://bugs.php.net/bug.php?id=28456

 

my suggestion is to add one text box with path (or more sophisticated folder pick if you wish) like...

 

configure.php ------------------------------------------------------------------

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>

<td class="main">

<?php

echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ';

echo tep_draw_input_field('products_path', $pInfo->products_path,' size="40" value="catalog/"');

echo tep_draw_file_field('products_image') . '<br/>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image);

?>

</td>

</tr>

 

upload.php ----------------------------------------------------------------------

$this->set_file($file);

$this->set_filename($_POST['products_path'].$file['name']);

 

daniel b

G&V Imaging

Archived

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

×
×
  • Create New...