Drupal 7 を使用して iOS アプリのコンテンツを管理しようとしています。Drupal を設定して、網膜 (@2x) サイズと非網膜サイズの画像を作成できます。アプリを更新して別のパスから @2x 画像を取得するのではなく、可能であれば mod の書き換えを使用して、別のフォルダーから @2x 画像を提供したいと考えています。
たとえば、非 Retina 画像へのパスは次のとおりです。 /sites/default/files/styles/ large
/public/flyers/OfficialSchedule.jpg?itok=qGpDKWpr
OfficialSchedule@2x.jpg のリクエストを /sites/default/files/styles/ retina
/public/flyers/OfficialSchedule.jpg?itok=qGpDKWpr から送信してください。
これは可能ですか?
結果: @jerdiggity に感謝
$conf['image_allow_insecure_derivatives'] = TRUE;
トークン値を追加せずに画像をリクエストできるようにするには、Drupal 7.20 以降の設定ファイルに追加する必要がありました。
# NOTES: Check the file name to see if it matches the @2x pattern:
RewriteCond %{REQUEST_FILENAME} ^(.*)(@2x\.\w+)$ [NC]
# NOTES: This may or may not be necessary, depending on your desired results (uncomment if so):
RewriteCond %{REQUEST_URI} ^(/sites/default/files/styles/regular/public/flyer/) [NC]
# NOTES: Rewrite everything with @2x, but don't rewrite requests to the /sites/default/files/styles/retina/public/flyer/ directory (duplicate rewrites)
RewriteCond %{REQUEST_URI} !^(/sites/default/files/styles/retina/public/flyer/) [NC]
RewriteRule ([^/]*)@2x\.(\w+) /sites/default/files/styles/retina/public/flyer/$1\.$2 [L,R=301]