Drupalメモのソースを表示
←
Drupalメモ
ナビゲーションに移動
検索に移動
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:Tips] == アバターの画像URLを絶対URLから相対URLに変更する == Drupalのアバターの画像URLは絶対URLとなります。これは、リバースプロキシ等のURLを変換してアクセスする環境において、画像がデットリンクとなることがあります。相対URLに変更するためには、「user.module」の「template_preprocess_user_picture」関数を以下とします。(変更箇所は15行目) <source lang="php" line> /** * Process variables for user-picture.tpl.php. * * The $variables array contains the following arguments: * - $account * * @see user-picture.tpl.php */ function template_preprocess_user_picture(&$variables) { $variables['picture'] = ''; if (variable_get('user_pictures', 0)) { $account = $variables['account']; if (!empty($account->picture) && file_exists($account->picture)) { // $picture = file_create_url($account->picture); $picture = file_create_url($account->picture); } else if (variable_get('user_picture_default', '')) { $picture = variable_get('user_picture_default', ''); } if (isset($picture)) { $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous')))); $variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE); if (!empty($account->uid) && user_access('access user profiles')) { $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE); $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes); } } } } </source> Drupalの拡張の作法に従っていないかもしれませんのでご注意ください。(あまり公式ドキュメントに目を通していないので) 動作環境 * バージョン : 6.20 == Proxyを使用して更新確認を行う == 「includes/common.inc」を以下のように変更します。(バージョン6.15を使用) <source lang="diff"> 457,460c457 < // --- mod start < //$fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); < $fp = @fsockopen('<WWW.XXX.YYY.ZZZ>', '<PORT>'); // 第1引数:ホスト名, 第2引数:ポート番号 < // --- mod end --- > $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); 533,537c530,531 < // --- mod start < // $request = $method .' '. $path ." HTTP/1.0\r\n"; < // $request .= implode("\r\n", $defaults); < $request = "$method ".$uri['scheme']."://".$uri['host'].$path." HTTP/1.1\r\n"; < // --- mod end --- > $request = $method .' '. $path ." HTTP/1.0\r\n"; > $request .= implode("\r\n", $defaults); </source> * 参考 ** http://drupal.org/node/7881 == 更新履歴 == * [[#アバターの画像URLを絶対URLから相対URLに変更する]]追加 -- 2010年12月26日 (日) 23:38 (JST) * ページ作成 -- 2010年11月6日 (土) 07:40 (UTC)
Drupalメモ
に戻る。
ナビゲーション メニュー
個人用ツール
ログイン
名前空間
ページ
議論
日本語
表示
閲覧
ソースを閲覧
履歴表示
その他
検索
案内
メインページ
導入手順
CMS
Tips
仮想化
Java
ソフトウェア開発
その他
最近の更新
ツール
リンク元
関連ページの更新状況
特別ページ
ページ情報