vanGogh Posted October 1, 2002 Share Posted October 1, 2002 Hello! I'm looking for somebody who can write me a little php-script. I have to upload several thousands products. But not for all I have a picture. So, what I like to have is a script, which searches the image-folder for available imagefiles and put these into the product-table. The image-filename is identically to the products_model. Can anybody help me? Thanks in advance! Stephen Quote Link to comment Share on other sites More sharing options...
webmastuh Posted October 17, 2002 Share Posted October 17, 2002 I think you are putting the cart before the horse. Or use someother backwards analogy :). If the picture names are the same as the image filename, why would you query the database to retrieve the pic name? Just recode the product_info.php and default.php pages to use the part number + .gif and then dump all of the pics in the directory. That would lighten the server load a bit to to not run a query for that. Does that help? rp Quote I am a spender, but Jesus Saves! Link to comment Share on other sites More sharing options...
vanGogh Posted October 17, 2002 Author Share Posted October 17, 2002 That is the easy way, if I have a picture for every product. But I don't. I only have pictures for a part of products, but put more in daily. That is, why I need a script, which I can start any time to check for which products images are available. Regards, Stephen Quote Link to comment Share on other sites More sharing options...
mattice Posted October 17, 2002 Share Posted October 17, 2002 So are the products already in your database or do you need: get *.jpg from images/ for each *.jpg insert into the database new product = * model = * image = /images/*.jpg Which you will only run once? Quote "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
mattice Posted October 17, 2002 Share Posted October 17, 2002 I only have pictures for a part of products, but put more in daily. Okay.. so you want the script to read the entire image directory into a big old array, and then do a query on the database for each picture name on the model field. If the modelfield == picturename you update the products image field with the picturename.jpg. That should not be too hard to do but will cost resources if your directory holds thousands of pictures. Quote "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
Guest Posted November 27, 2002 Share Posted November 27, 2002 I am just curious as to if this ever went anywhere, I have basically the same problem, 15000 products 2500 images images are names the same as the product so I used easy populate to import my prods and simply put the product name+.gif at the end in the image column in excel. Problem is what about the 12500 products that have no image? system will look for the image I placed in the column and not find it, so it will put out the red x I would think that it would be fairly easy to write a small script that says,, ok look for the image that was given, If it can't be found, just default to this image. Can this be done? Quote Link to comment Share on other sites More sharing options...
rhedlund Posted November 27, 2002 Share Posted November 27, 2002 An even better solution would be to mod the picture display parts so that wheneever a link to a picture is to be displayed, its existance is checked first, and if not available a default "no picture" link is inserted instead. The "no picture" should be configurable from admin, of course. Maybe different pictures depending on category or other params. This way you just check the actually chosen images from the file system at run time. The "no picture" will show until the second you upload the image. Just an idea for a mod. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2002 Share Posted November 29, 2002 I agree, This would be a go contibution, especially for those of us who use import contribs like easy populate, for large numbers of products,. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 29, 2002 Share Posted November 29, 2002 We understand that there are default image contribs, But I do not belive that they will show a default image if you asign the product a image that is not found. You would have to leave the image field empty, and to go in and empty the image fiel on 12500 out of 15000 products would be insane. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.