Image link broken

picture

I have been looking for years after a good data system for my 20,000+ pictures and have now found it.
Anders Nilsson - Toftendata - Denmark

1 reply [Last post]
kcoquia
Offline
Joined: 05/19/2011

I store all of my images on a share on a server, and my admin recently changed the name of the share, breaking the link to every image in my database. Does anyone know how to fix this in MySQL or DBGallery?

dbgallery
dbgallery's picture
Offline
Joined: 02/26/2011
Image link broken

The cleanest way to do this is via a MySql query. 

First:

Quit DBGallery

Backup the database as per normal procedures.  Please do not ignore this step!  Unless using your companies particular backup mean, backup is described in DBGallery's User Guide.


 Then execute the following Sql:

use dbgallery;

update images set img_loc = replace(img_loc, '\\<old share name>\\', '\\<new share name>\\');

 

 

update folders set folder_fullpath = replace(folder_fullpath, '\\<old share name>\\', '\\<new share name>\\');

 

 


Replace <old share name> and <new share name> with what is in your environment.  Note the single quotes and \\ are required.

Example:
----------------
I had a photo server named QAServer with a shared drive named SharedPhotos.  Hence a path to a photo was

'\\QAServer\SharedPhotos\2011-01 - Snowy Mountains\IMG_00234.jpg'. 

The share was renamed to ImageShare.  The full path then became

'\\QAServer\ImageShare\2011-01 - Snowy Mountains\IMG_00234.jpg'

Hence the following Sql was needed:

update images set img_loc = replace(img_loc, '\\SharedPhotos\\', '\\ImageShare\\');
update folders set folder_fullpath = replace(folder_fullpath, '\\SharedPhotos\\', '\\ImageShare\\');

 

 

I hope you agree it's nice and simple.


Executing the Sql
-----------------------------
Regarding how to execute the Sql, you'll need a software tool which allows you to execute Sql statements against a MySql database.  If using DBGallery regularly you likely already have MySql Administrator and Query Browser, especially if following the User Guide's database backup instructions.  Use the Query Browser, or other similar software such as the awesome MySql Workbench, to execute the Sql above.

 

Best Regards,

Glenn

Developer of DBGallery: The Photo Database System