∵ Takayoshi Saito ∴ 2012-11-25 ∞ 1'
HTMLの画像リクエストを受け取って、サーバーに画像が存在したらキャッシュを返して、サーバーに画像が存在しなかったら外部に画像を取得しに行くPHPコードのサンプルです(一部省略しています。pecl install imagick必須です)。
thumbnailImage($resize, 0); $thumpath = str_replace(".jpg","_$resize.jpg",$cachepath); file_put_contents($thumpath,$image); header('Content-type: image/jpeg'); readfile($thumpath); } else{ header('Content-type: image/jpeg'); readfile($cachepath); }