0

セッション別またはログイン ユーザー別の画像は正常に読み込まれ、表示されますが、セッション ユーザー以外のユーザーからの画像は表示されません。注:すべての画像のURLは問題なく読み込まれ、画像だけが表示されません。

イメージコントローラー:

def thumbphoto = {
    response.setContentType('image/jpeg')
    response.setHeader('Cache-control', 'no-cache')

    if(params?.id != null && !(params?.id.empty)){
      params.maxWidth?: 50.00
      params.maxHeight?: 50.00
      response.outputStream << imageProxyService.loadThumbnailImage(params.id, securityService.passwordEncoder(userId.toString()))
    }
}

画像とスローガンを出力するためのクエリ

def statusQuery = """SELECT c.user_account_id as userId, c.status_message as message, c.status_type as profile, se.id, se.photo FROM user_account se, status c
                    WHERE
                    c.user_account_id = se.id
                    GROUP BY se.id, c.user_account_id, c.status_message, c.status_type, se.photo"""

gsp で画像を表示する:

<g:each in="${statusList}" status="i" var="status" status="i">
            <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <tr>
              <td>

                  <img id="profile_photo" src="${createLink(controller:'image', action:'thumbphoto', id:status.photo, params:[maxWidth:50.0,maxHeight:50.0])}" alt="" title="" />
            </td>
            <td>${status.id}: ${status.message}</td>
            </tr>
4

1 に答える 1

0

id:status.photoあなたはIDを上書き していますparams:[id:status.id]

編集:そして通過しないuserId

リンクを作成して、そこに userId を追加してみてください: <img id="profile_photo" src="${createLink(controller:'image', action:'thumbphoto', id:status.photo, params:[userId:status.userAccount.id, maxWidth:50.0,maxHeight:50.0])}" alt="" title="" />

于 2013-06-06T23:41:14.507 に答える