0

Grailsでは、画像のURLは正常に読み込まれますが、画像は表示されません...

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

    if(params.id){
      userId = params.id
    }
    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()))
    }
  }

ユーザーには多くの画像があります。これは、ステータスの更新と共に画像を読み込んで表示しようとしている gsp ビューです。

<g:each in="${statusList}" status="i" var="status" status="i">
            <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
            <tr>
              <td>
            <g:if test="${status.photo != null  && !(status.photo.empty)}" >
                  <img id="profile_photo" src="${createLink(controller:'image', action:'thumbphoto', id:status.photo, params:[maxWidth:50.0,maxHeight:50.0,id:status.id])}" alt="" title="" />

            </g:if>
            <g:else>
              <img id="profile_photo" src="${resource(dir:'images', file:'no_image_blue.gif')}" alt="No Image" width="50" height="50"/>
            </g:else>
            </td>
            <td>${status.id}: ${status.message}</td>
            </tr>
            </tr>
          </g:each>
4

2 に答える 2

1

Firebugをインストールし、 [ネット] タブに移動します。

すべての HTTP リクエストとそのステータスが表示されます。

画像に対して404が表示される可能性があります。webappsフォルダーの下の場所を確認してください...

ここでも、Firebug がすべてのヒントと解決策を提供します。

于 2013-06-03T23:00:49.217 に答える