Request modify API getRemoteThumbnailByServer -> iOS
Now the function required : Width and Height but i need a proportionate imagines (scaled) i don't know the original dimension of image...
Possibility : if Width or Height it's 0 return then image scaled and proportionate
Example : Width = 640 Height = 0 return the image proporzionate with Width = 640
other ideas ??
@schiessle
cc @rullzer - isn't this already implemented somehow?
Uhm yes you can pass -1 as width or height and it will be scaled appropiated. Maybe we can do this even cleaner but I just copied the old code that parses the arguments.
@rullzer Any chance to properly document this ?
Arrggghhhhhh @MorrisJobke @rullzer but where is the documentation for this ?
there is none. But to be fair there is no documentation at all on that endpoint. Will add it to the todo list. But I warn you that it is already pretty long...
@rullzer for iOS Client how do i know what exists? API
For certain procedures i am going crazy ... for example the getRemoteThumbnailByServer with scaled it's a plus for INCREDIBLE greatly speed of the downloads, i can view a preview and download the full image in the background (see dropbox) ... :fearful:
@marinofaggiana uhm well. Until somebody documents them we have no way besides browsing the source. Not saying that is good. But that is the way it currently is.
@rullzer i test now the API but with -1 return error ... are you sure ?
{"message":"Requested size must be numeric and a positive value."}
What is the endpoint you use?
What is the endpoint you use?
@rullzer Just place a curl statement in here to bring this ping pong game to an end ;)
/index.php/apps/files/api/v1/thumbnail/
@rullzer ?
Ah sorry this fell of my radar. Right the files endpoint is not accepting that.
Let me think how to solve this properly. But for <= NC 11 there is not much we can do at the moment.
@rullzer ok, thanks, but it's very important the doc of API (all API), i want speak of these with @karlitschek , the mobile app are the first interface and i think thats any deployment of servers should have the same on the client .. now the client (ios / android. .. windows mobile) do not have search, favorite sync, trash and moore ... and i don't know if the new version 11 have thought to this one problem ...
What do you think about this suggestions?
Yes I agree.
But as stated if there are no docs it is not officially supported right now.
toc toc, I need here ... @rullzer , @tobiasKaminsky are you agree?
On Android I am just passing the desired with/height to this endpoint.
It is the with/height of my thumbnail/image area on Android and thus I always know the values.
Can't you also user the values from iOS? Or do I understand something wrong?
@tobiasKaminsky I don't know the form (with/height) of image and if I download the thumbnail the image is distort (no proportionate) the getRemoteThumbnailByServer required the H and W ... No ?
Why don't you know the form? You have on iOS some sort of canvas / image form, where you want to put the image into. So you can use this?
I don't know the form (h w) of original image, you yes ? how ?
Why do you need to know the form (h/w) of original image?
for download the correct Thumbnail ... example
Original Image : 3000 X 800
Thumbnail : 640 x ... ? (170) but I dont know the original form (h/w) and I download as ?
getRemoteThumbnailByServer (H 640 W ... ?)
@rullzer write :
Uhm yes you can pass -1 as width or height and it will be scaled appropiated. Maybe we can do this even cleaner but I just copied the old code that parses the arguments.
but this do not works
hm. we do it this way:
Original image 3000 x 800
Thumbnail (is always square), we know the desired image size in our app, eg. 120x120.
Resized images (shows correct aspect ratio), we also know the screen density, eg. 1280x784 and use this endpoint:
"/index.php/core/preview.png?file="remotePath + "&x=" + pxW + "&y=" + pxH + "&a=1&mode=cover&forceIcon=0";
So we do not need to know any value of the original image, but only from the desired image.
There is some logic for finding the right ratio when u pass -1 for height, width or both. But api endpoint does not accept these .
@tobiasKaminsky :
"/index.php/core/preview.png?file="remotePath + "&x=" + pxW + "&y=" + pxH + "&a=1&mode=cover&forceIcon=0";
??? pxW & pxH whats put see example ? you don't use API getRemoteThumbnailByServer ?
Thumbnail (is always square) mmm no, I want a image with 640 w and H in proportion
p.s. @danielkesselberg yes correct
@rullzer ping.
I need to write proper docs (yes it is on the todo).
Anyway. You can have the endpoint scale automatically. It will get the closest larger image it can find.
So if you have 640x480 screen. And you request that but you say we should honor aspect ration. Then it will return for example an image of 700x512 if that is what we have.
example:
<server>/core/preview?fileId=<FILEID>&x=<WIDTH>&y=<HEIGHT>&a=true&mode=cover
That should give you workable previews.
@rullzer thanks! ok I try but API getRemoteThumbnailByServer with a square (example 120x120) scale automatically or not .... not I think and the image is distort
@marinofaggiana if you want a square image do:
<server>/core/preview?fileId=<FILEID>&x=<WIDTH>&y=<HEIGHT>&a=false&mode=cover
so with a=false
yes thx
@rullzer :
Toby write :
https://cloud.xxxxxx.it/index.php/core/preview.png?file=1/1.jpg&x=640&y=480&a=1&mode=cover
and this works.
You write :
this not works.
Are you sure :
Your fileid is not correct. The fileid is just a number.
However you can also use the endpoint with the path is that is easier for you.
your file id is the "remote id", wich is "fileId" (8 digit) + "serverId"
00283798ocr6ct4odsi8 -> 00283798 + cr6ct4odsi8 --> fileId = 283798
https://cloud.xxxx.it/index.php/core/preview?fileID=283798&x=640&y=480&a=1&mode=cover
No ... I use the endpoint with path...
Yes because that is the wrong url:
It should then be:
https://cloud.xxxx.it/index.php/core/preview?fileID=283798&x=640&y=480&a=1&mode=cover
no. :-)))
ok guys ... bye
Ah you changed the parameter:
https://cloud.xxxx.it/index.php/core/preview?fileId=283798&x=640&y=480&a=1&mode=cover
ANyway else just use the one with the path.
Okay ... as this is a documentation issue we should close it.