close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

storing and manipulating images on server

Thread began 6/05/2016 5:27 pm by Christopher West | Last modified 6/08/2016 6:09 pm by Ray Borduin | 112 views | 6 replies |

Christopher WestCommunity Expert

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:
<?php if (file_exists("images/products/".strtoupper (substr($rsProducts->getColumnVal("ProductBrand"), 03)).$rsProducts->getColumnVal("ProductSKU").".jpg")) { ?>

          
       <img  src="images/products/<?php echo strtoupper (substr($rsProducts->getColumnVal("ProductBrand"), 03)); ?><?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

Sign in to reply to this post

Ray BorduinWebAssist

I would normally create an images table and keep track of the images that way.. but you could use image name or folder structure instead. I'd maybe save the images into a folder name with the sku rather than the file name itself so you don't have to search through a ton of images to find the right ones.

Sign in to reply to this post

Christopher WestCommunity Expert

Hi Ray. Ok my questions to your reply;
(1) when you said 'save the image into a folder with the SKU...what did you mean? Because if you mean the actual folder named as the SKU, then that would mean lots of folders so would take even longer to search through!
(2) taken from above I could create folder names as brands, and then the SKUs within the brand folder...that could be a better way of reducing.
(3) the main reason I put this forum post forward for feedback is because the client wants to provide me with an excel spreadsheet of products, now if I were to store image filenames in an image table on the database, then that would mean the client would need to know the ID column from the products table to then input into a second spreadsheet for the image table....that will get very messy since the client only has basic computer skills...that's why I thought to just allow them to upload the images directly as I can use a multi image upload script file where they can drag and drop images on the webpage and they get uploaded automatically, and as long as the image name has the correct SKU then it would automatically be associated with the product in the database.

Chris

Sign in to reply to this post

Ray BorduinWebAssist

1) I meant a folder with the SKU... that way when you browse to a product you could go straight to that folder and wouldn't have to filter out any images since all of the images in that folder would be for that product.
2) You could do this however you wanted to. I'm just suggesting methods I've used in the past and don't know your specific scenario.
3) That seems like a valid enough reason to use a flat file solution rather than a database.

Sign in to reply to this post

Warrio

If it's of any help, we store our images by sku eg. 124589763.jpg in a one to many table, one product can have many images so it goes sku 124589763-1.jpg 124589763-2.jpg.

We have over 40,000 images on a cdn, when we create a new product, we store the images on our local machine, when an new image is added, we have software called goodsync than senses the change in the local folder and uploads the images into the same file structure on gogrid cdn.

The new product is launched on our websites and all the images are available for distribution everywhere.

Works for us

Cheers
Norman

Sign in to reply to this post

Christopher WestCommunity Expert

Hi, thanks Warrio for your insight. I think I will look for a simplify solution as I don't want to spend out any money on syncing software and the client would never want to do that either. I guess storing image names in a table isn't really needed since there are php functions to allow direct access to the files. Usually I would create a one to many table like you suggest and I will be using image filenames with -1 -2 -3 etc appended at the end of the SKU. And then I can differentiated between the primary image and the additional images to check if it has the -# appended at the end. Mind you I wonder if this may cause issues with my product image slider on the product detail page as it would swap out the images when the customer clicks on the smaller thumbnail (standard practice).

Sign in to reply to this post

Warrio

Hi Christopher, most of our customers visit by phone or ipad, so speed is pretty important to us, hence the cdn for images and cloudflare.
In Sydney we've reduced loading time for a page from 8 seconds to around 1.

The synching software was only $30 flat one off charge, 40K images around $6 a month hosting on gogrid, cloudflare free.

Fortunately we don't build websites for other people so we can do mostly anything we wan't

Good luck with the project

cheers
Norman

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...