Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ fun OwnCloudClient.toNextcloudClient(context: Context): NextcloudClient = OwnClo
isFollowRedirects
)

fun OwnCloudClient.getPreviewEndpoint(localFileId: Long, x: Int, y: Int): String = baseUri
fun OwnCloudClient.getPreviewEndpoint(remoteId: String, x: Int, y: Int): String = baseUri
.toString() +
"/index.php/core/preview?fileId=" +
localFileId +
remoteId +
"&x=" + (x / 2) + "&y=" + (y / 2) +
"&a=1&mode=cover&forceIcon=0"
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,7 @@ public static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMana
int pxW = p.x;
int pxH = p.y;

if (file.isDown()) {
if (file.isDown() && MimeTypeUtil.isImage(file)) {
Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile(file.getStoragePath(), pxW, pxH);
if (bitmap != null) {
if (OCFileExtensionsKt.isPNG(file)) {
Expand All @@ -1279,7 +1279,7 @@ public static Bitmap doResizedImageInBackground(OCFile file, FileDataStorageMana
GetMethod getMethod = null;

try {
String uri = OwnCloudClientExtensionsKt.getPreviewEndpoint(mClient, file.getLocalId(), pxW, pxH);
String uri = OwnCloudClientExtensionsKt.getPreviewEndpoint(mClient, file.getRemoteId(), pxW, pxH);
Log_OC.d(TAG, "generating resized image: " + file.getFileName() + " URI: " + uri);

getMethod = new GetMethod(uri);
Expand Down
Loading