Commit 5674e412 authored by Matija Obreza's avatar Matija Obreza

Using JPEG for thumbnails (smaller size)

parent 5ae480e4
...@@ -83,11 +83,11 @@ public class RepositoryDownloadController { ...@@ -83,11 +83,11 @@ public class RepositoryDownloadController {
response.setDateHeader(HttpHeaders.LAST_MODIFIED, repositoryFile.getLastModifiedDate().getTime()); response.setDateHeader(HttpHeaders.LAST_MODIFIED, repositoryFile.getLastModifiedDate().getTime());
response.setHeader(HttpHeaders.ETAG, repositoryFile.getSha1Sum()); response.setHeader(HttpHeaders.ETAG, repositoryFile.getSha1Sum());
response.setContentType("image/png"); response.setContentType(ImageGalleryService.THUMB_CONTENT_TYPE);
// Cache for 24hrs // Cache longer for public files
if (SecurityContextUtil.anyoneHasPermission(repositoryFile, "READ")) { if (SecurityContextUtil.anyoneHasPermission(repositoryFile, "READ")) {
response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, public, no-transform"); response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=2592000, s-maxage=2592000, public, no-transform");
} else { } else {
response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, private, no-transform"); response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, private, no-transform");
} }
...@@ -119,7 +119,7 @@ public class RepositoryDownloadController { ...@@ -119,7 +119,7 @@ public class RepositoryDownloadController {
// Cache for 24hrs // Cache for 24hrs
if (SecurityContextUtil.anyoneHasPermission(repositoryFile, "READ")) { if (SecurityContextUtil.anyoneHasPermission(repositoryFile, "READ")) {
response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, public, no-transform"); response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=2592000, s-maxage=2592000, public, no-transform");
} else { } else {
response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, private, no-transform"); response.setHeader(HttpHeaders.CACHE_CONTROL, "max-age=86400, s-maxage=86400, private, no-transform");
} }
......
...@@ -421,7 +421,7 @@ ...@@ -421,7 +421,7 @@
<c:forEach items="${imageGallery.images}" var="image"> <c:forEach items="${imageGallery.images}" var="image">
<div x-uuid="<c:out value="${image.uuid}" />" x-ext="<c:out value="${image.extension}" />" style="cursor: pointer;" class="col-lg-2 col-md-4 col-sm-4 col-xs-6"> <div x-uuid="<c:out value="${image.uuid}" />" x-ext="<c:out value="${image.extension}" />" style="cursor: pointer;" class="col-lg-2 col-md-4 col-sm-4 col-xs-6">
<div class="img-wrapper"> <div class="img-wrapper">
<img src="<c:url value="${cdnServers.next}/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.png" />" alt="<c:out value="${image.title}" />"/> <img src="<c:url value="${cdnServers.next}/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.jpg" />" alt="<c:out value="${image.title}" />"/>
</div> </div>
</div> </div>
</c:forEach> </c:forEach>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="row" id="imagegallery-thumbs"> <div class="row" id="imagegallery-thumbs">
<c:forEach items="${imageGallery.images}" var="image"> <c:forEach items="${imageGallery.images}" var="image">
<div x-src="<c:out value="${image.storagePath}" />" class="col-xs-6 col-sm-3 col-md-2 col-lg-2"> <div x-src="<c:out value="${image.storagePath}" />" class="col-xs-6 col-sm-3 col-md-2 col-lg-2">
<img style="width: 100%; margin-bottom: 15px; margin-top: 15px;" src="<c:url value="/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.png" />" alt="${image.title}" /> <img style="width: 100%; margin-bottom: 15px; margin-top: 15px;" src="<c:url value="/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.jpg" />" alt="${image.title}" />
</div> </div>
</c:forEach> </c:forEach>
</div> </div>
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="row" id="imagegallery-thumbs"> <div class="row" id="imagegallery-thumbs">
<c:forEach items="${imageGallery.images}" var="image"> <c:forEach items="${imageGallery.images}" var="image">
<div x-src="<c:out value="${image.storagePath}" />" class="col-xs-6 col-sm-3 col-md-2 col-lg-2"> <div x-src="<c:out value="${image.storagePath}" />" class="col-xs-6 col-sm-3 col-md-2 col-lg-2">
<img style="width: 100%; margin-bottom: 15px; margin-top: 15px;" src="<c:url value="/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.png" />" <img style="width: 100%; margin-bottom: 15px; margin-top: 15px;" src="<c:url value="/repository/d/_thumbs${image.thumbnailPath}/${thumbnailFormat}.jpg" />"
alt="${image.title}"/> alt="${image.title}"/>
</div> </div>
</c:forEach> </c:forEach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment