Forums / Setting Up Categories, Products, Attributes / Looking for MYSQL Query to change image extension from .JPG to .jpg

Looking for MYSQL Query to change image extension from .JPG to .jpg

Started by jdmengineland on 19 Dec 2011, 7:01 PM · Views: 3,335

Results 1 to 5 of 5
19 Dec 2011, 7:01 PM
#1
jdmengineland avatar

jdmengineland

New Zenner

Join Date:
Feb 2010
Posts:
11
Plugin Contributions:
0

Looking for MYSQL Query to change image extension from .JPG to .jpg

MYSQL Query...to change image extension from .JPG to .jpg

need a mysql query to change all file extensions from .JPG to .jpg....

19 Dec 2011, 8:44 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Looking for MYSQL Query to change image extension from .JPG to .jpg

Are you trying to change the actual image filename extensions? You can't do that with MySQL; that can only affect info stored in the database.

19 Dec 2011, 11:03 PM
#3
jdmengineland avatar

jdmengineland

New Zenner

Join Date:
Feb 2010
Posts:
11
Plugin Contributions:
0

Re: Looking for MYSQL Query to change image extension from .JPG to .jpg

no the files are already changed, but the file extension WITHIN the Database, need to be changed to all lower case just the extension

so basically i would need a query to just look up product image, and change all extensions to .jpg from .JPG

because right now since all the files have .jpg and DB is looking for .JPG.. and not showing any images.

http://www.jdmengineland.com check out the product listing it doesnt show most images.

20 Dec 2011, 9:54 AM
#4
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: Looking for MYSQL Query to change image extension from .JPG to .jpg

BACKUP DBASE FIRST!!!!!

UPDATE zen_products SET products_image = REPLACE(products_image, "JPG", "jpg") WHERE RIGHT(products_image, 3) = "JPG";

Naturally, if your dbase does NOT use prefixes...

UPDATE products SET products_image = REPLACE(products_image, "JPG", "jpg") WHERE RIGHT(products_image, 3) = "JPG";

20 years a Zencart User

20 Dec 2011, 1:11 PM
#5
jdmengineland avatar

jdmengineland

New Zenner

Join Date:
Feb 2010
Posts:
11
Plugin Contributions:
0

Re: Looking for MYSQL Query to change image extension from .JPG to .jpg

thank you, much appreciated.