About my recent non-functioning photos

A while ago, my images stopped displaying correctly. After a lot of troubleshooting and forum posts, I finally found the reason (and solution to) my image links not displaying correctly.

Images on the web work by referencing other files; like receiving a letter without photos but the letter itself asks the receiver to look at images they can already look at (maybe like “remember our summer on ’06? Take a look at the album we made all those years ago!”). The images could not be loaded because the sender asked the receiver to look in the wrong location for the photos.

This happened because I had moved WordPress multiple times and it moved my photos to that same location as well—however, my “letters” didn’t update the “receiver” to look in the right place. Now, WordPress posts are managed by a database. I can easily update the database to point the old locations to a new location by looking for patterns. I ran a SQL command like this:

UPDATE wp_posts SET post_content = REPLACE(post_content, "src=\"http://www.christophermartin.name/blog/wp-content/", "src=\"http://www.christophermartin.name/WordPress/wp-content/")

WHERE post_content LIKE "src=\"http://www.christophermartin.name/blog/wp-content/ %"

It ran. I couldn’t for the life of me get the SQL command to return a result, the whole reason for running such a command. So I’m now manually replacing such information using a fantastic Mac application called Sequel Pro.

The fact that I can’t correctly write a SQL command just shows that I have to brush up on my MySQL.

Until next time.

Comment on this post!