I changed my vps server recently, and I had to migrating my wordpress blog too. I found there are several trouble when I completed migrating, and the most serious trouble is some image in some posts was broken. so here come.
How to use
一、 Just run python:
1 | python wordpress_fix_img.py |
二、 Input data:
1 | wordpress path(example: /var/www/blog.dreamtobe.cn/html/): [your wordpress absolute path] |
三、Auto find broken image
In this phase, will auto find break image by python and print all image url in posts. Just like:
1 | 2092Android UI设计 layout布局 屏幕底部的菜单栏 动画切换Activity |
四、Provide right image name
In 3 phase, you need provide right image file name when find break image, such as:
1 | http://blog.dreamtobe.cn/wp-content/uploads/2014/12/endDocument1.jpg |
Press enter, and python will autocompleted image right url, and output:
1 | new image url:http://blog.dreamtobe.cn/wp-content/uploads/2014/12/endDocument.jpg |
And after the completion of the full content of the post scan output:
1 | update done. ID =2160L |
五、Repeate 3~4 & end
As end will output:
1 | Complete scan, replace 25 image url from 21 posts |
Github URL & Download
https://github.com/Jacksgong/wordpress-image-rescue