storing and manipulating images on server
Hi there, this is a question I wanted to ask in terms of work flow on a website. And I wanted to get feedback.
For my ecommerce website I am storing product images on the server with the product SKU as the filename.
(1) Would you say this is standard practice? obviously it wouldn't be great for SEO value. (but I am using the product name in the alt tag on the page).
So that I can display a "image coming soon" image on the page if there is no product image on the server, I am using an IF statement that checks the file, example:
<?php if (file_exists("images/products/".strtoupper (substr($rsProducts->getColumnVal("ProductBrand"), 0, 3)).$rsProducts->getColumnVal("ProductSKU").".jpg")) { ?>
<img src="images/products/<?php echo strtoupper (substr($rsProducts->getColumnVal("ProductBrand"), 0, 3)); ?><?php echo($rsProducts->getColumnVal("ProductSKU")); ?>.jpg" class="responsive-image" />
<?php } ?>
It made me think, could I create a PHP script somewhere in the admin so that the php code will check the filename on the server and then cross references it to the product sku which is stored in my products table, once there is a successful result it then writes a new record to my images table in the database?
(2) The reason I am asking this, is I kind of feel I should be storing image file names in a database table.
What do you think? Are there any pros and cons to my above workflow?
Chris


