Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bulk Image Renaming / Convention


Mort-lemur

Recommended Posts

While I have a little spare time I have decided to tidy up my images with regard to the naming convention used.

 

My site has been running for many years and has 1000's of images, historically it has not mattered what name these images had eg:

 

my picture.jpg

my-picture.jpg

mypicture.jpg

my=picture.jpg

 

However, when using twitter product tweets, the picture naming convention is quite strict and will only accept:

 

my_picture.jpg

mypicture.jpg

 

Is there any way that anyone is aware of (other than by single item editing) to change the naming convention of images?

 

Many Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Thanks Gary,

 

But could it also be done this way:

 

1) Download all images to desktop and use one of the free bulk renaming programmes to do a search and replace for spaces and dashes.

 

2) Run an SQL command against the database to do the same for the image names being called up?

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

could it also be done this way:

 

1) Download all images to desktop and use one of the free bulk renaming programmes to do a search and replace for spaces and dashes.

 

2) Run an SQL command against the database to do the same for the image names being called up?

 

Yes, that would work - why not ?  

 

Only issue there is the waste of time downloading and uploading. 

 

Be aware that you will need some sort of "failsafe", as;

 

 

my-perfect-pic.jpg (eg used on product 123)

and

my-perfectpic.jpg (eg used for product 456)

 

would/could both be renamed to

 

myperfectpic.jpg

 

which could result in images being incorrectly aligned to products.

 

Using a script makes it simple ... prefix the new name with the product ID, eg:

 

123_myperfectpic.jpg 

456_myperfectpic.jpg 

Link to comment
Share on other sites

Thanks Gary,

 

Good point, but I was thinking of search and replace for say "-" with "_"

 

so

 

my-perfect-pic.jpg (eg used on product 123) would become my_perfect_pic.jpg

 

and

 

my-perfectpic.jpg (eg used for product 456) would become my_perfectpic.jpg

 

To my understanding twitter accepts underscores on product images and using the above they would both retain their uniqueness.

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Using a script, as Gary suggest, you could manipulate the image names even more, for example

 

[products_name]_[products_id]_[image_id].extension

or
[manufacturer_name]_[products_name]_[products_id]_[image_id].extension
or
[products_category]_[products_model]_[products_id]_[image_id].extension
 
Additionally, you could move by this chance all of your product images to a separate folder
Link to comment
Share on other sites

I doubt that this will be the case but if you use "very" long image names or if you start to add product_ids or model numbers additional to it make sure that you stay below 64 letters or adjust the database to a higher VARCHAR number. Currently set to VARCHAR(64)

Link to comment
Share on other sites

The product ID is necessary to have in order to ensure that each image name is unique

 

Long or short image names is a decision anyone can make, database fields may need a adjustment, yes

 

Not sure what your "doupt" is about?

Link to comment
Share on other sites

I doubt that she will go over 64 letters for an image name. That is what i meant with "doubt". But i thought i should mention it since i exceeded that amount and the image name got cut off and therefore the image was not showing.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...