Powerstore 3 - Seperate folders for images
I am trying to get my Thumbnails to be stored in a seperate folder from my ProductImage.
Currently I have managed to get this to work by changing the UploadFolder for the ProductImage from:
'UploadFolder' => "../imagesupload/",
to
'UploadFolder' => "../imagesupload/images/productShots/large/",
and similar changes to the ThumbNail UploadFolder as follows:-
'UploadFolder' => "../imagesupload/images/productShots/small/",
I have also change how the image link is stored on my database as follows under $WA_fieldValueStr in both Products_Update.php and Products_Insert.php as follows.
$WA_fieldValuesStr = "".((isset($_POST["ProductSKU"]))?$_POST["ProductSKU"]:"") ."" . "|" . "".((isset($_POST["ProductName"]))?$_POST["ProductName"]:"") ."" . "|" . "".((isset($_POST["ProductPrice"]))?$_POST["ProductPrice"]:"") ."" . "|" . "".((isset($_POST["ProductWeight"]))?$_POST["ProductWeight"]:"") ."" . "|" . "".((isset($_POST["ProductCartDesc"]))?$_POST["ProductCartDesc"]:"") ."" . "|" . "".((isset($_POST["ProductShortDesc"]))?$_POST["ProductShortDesc"]:"") ."" . "|" . "".((isset($_POST["ProductLongDesc"]))?$_POST["ProductLongDesc"]:"") ."" . "|" . "images/productShots/small/".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"] ."" . "|" . "images/productShots/large/".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|" . "".((isset($_POST["ProductStock"]))?$_POST["ProductStock"]:"0") ."" . "|" . "".((isset($_POST["ProductLive"]))?$_POST["ProductLive"]:"") ."" . "|" . "".((isset($_POST["ProductUnilimited"]))?$_POST["ProductUnilimited"]:"") ."";
This stores the links to my images as follows in my mysql database as follows:
images/productShots/large/ProductImage.jpg
images/productShots/small/ThumbNail.jpg
This all seems alright when creating a new product under Products_Insert.php
However, when actually using Products_Update.php it is working when I am actually updating the product with new images to replace the original images.
But if I have nothing in the two image update fields, say when selecting to make a product available or unavailable, then the Product updates as normal, but the image are no longer available.
This is because when there is no image in the image fields, the function controlling the update of the images takes what is in the database as the filename and appends the "images/productShots/small/" or "images/ProductShots/large" each time.
So the database shows:
images/productShots/large/images/productShots/large/ProductImage.jpg
images/productShots/small/images/productShots/small/ThumbNail.jpg
This gets bigger everytime I do an update without putting new images in the fields.
Extract from above $WA_fieldValuesStr =
. "|" . "images/productShots/small/".$WA_DFP_UploadStatus["WA_UploadResult2"]["serverFileName"] ."" . "|" . "images/productShots/large/".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] ."" . "|"
I would appreciate any help in finding a solution around this problem which will still allow me to seperate my ThumbNails from my ProductImages