更換網誌圖床

  一直以來都把網誌的圖片放在Dropbox,但最近收到Dropbox通知,3/15準備把Public的公開資料夾功能拿掉,雖然還是可以用”分享連結”The way,讓圖片可以外連,但這個轉換工作太浩大,且難保未來不會再調整一次,Therefore, assessment of the picture altogether moved to a more stable space。

一開始有考慮Flickr,但雅虎對於免費服務的做法實在讓我有些擔心,加上後來看到有人說,Flickr拿來作圖床的速度有點偏慢,So give up。

後來看了一下主機商ACSite給的空間與頻寬不算少,乾脆就移回自己的空間,雖然圖片檔案不少,所幸以往都有做過處理在上傳,So the overall volume than I expected much smaller。

本想愚公移山的一篇一篇做修改,後來想到應可從後端資料庫直接批次修改,跟同事請教了SQL語法後,CHECK Available Replace syntax reach。

試了好一陣子,總算把語法修對,The following is a record:

==

  • First to confirm the condition of the SELECT。(下面如果沒加入’ID’欄位,新版phpMyAdmin會出現要求unique欄位的錯誤)

SELECT ID, REPLACE (`post_content`, ‘https://dl.dropboxusercontent.com/u/906344/image’,

‘https://it-help.tips/img’) FROM `lee_wp_posts` WHERE `post_title` LIKE ‘%ubuntu上執行Foxy%’;

 

  • 確認無誤後,以下列語法執行

UPDATE `lee_wp_posts` SET `post_content` = REPLACE(`post_content`,

‘https://dl.dropboxusercontent.com/u/906344/image/’, ‘https://it-help.tips/img/’)

 

[Links]

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.