Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API getRemoteThumbnailByServer #1490

Closed
marinofaggiana opened this issue Sep 22, 2016 · 39 comments
Closed

API getRemoteThumbnailByServer #1490

marinofaggiana opened this issue Sep 22, 2016 · 39 comments

Comments

@marinofaggiana
Copy link
Member

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

@MorrisJobke MorrisJobke removed the 3. to review Waiting for reviews label Dec 5, 2016
@MorrisJobke
Copy link
Member

cc @rullzer - isn't this already implemented somehow?

@rullzer
Copy link
Member

rullzer commented Dec 8, 2016

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.

@MorrisJobke
Copy link
Member

@rullzer Any chance to properly document this ?

@marinofaggiana
Copy link
Member Author

Arrggghhhhhh @MorrisJobke @rullzer but where is the documentation for this ?

@rullzer
Copy link
Member

rullzer commented Dec 8, 2016

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...

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Dec 8, 2016

@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) ... 😨

@rullzer
Copy link
Member

rullzer commented Dec 8, 2016

@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.

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Dec 8, 2016

@rullzer i test now the API but with -1 return error ... are you sure ?

{"message":"Requested size must be numeric and a positive value."}

@rullzer
Copy link
Member

rullzer commented Dec 8, 2016

What is the endpoint you use?

@MorrisJobke
Copy link
Member

What is the endpoint you use?

@rullzer Just place a curl statement in here to bring this ping pong game to an end ;)

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Dec 8, 2016

/index.php/apps/files/api/v1/thumbnail/

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Dec 12, 2016

@rullzer ?

@rullzer
Copy link
Member

rullzer commented Dec 14, 2016

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.

@marinofaggiana
Copy link
Member Author

@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?

@rullzer
Copy link
Member

rullzer commented Dec 14, 2016

Yes I agree.

But as stated if there are no docs it is not officially supported right now.

@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jun 20, 2018
@marinofaggiana
Copy link
Member Author

marinofaggiana commented Aug 1, 2018

toc toc, I need here ... @rullzer , @tobiasKaminsky are you agree?

@nextcloud-bot nextcloud-bot removed the stale Ticket or PR with no recent activity label Aug 1, 2018
@tobiasKaminsky
Copy link
Member

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?

@marinofaggiana
Copy link
Member Author

@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 ?

@tobiasKaminsky
Copy link
Member

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?

@marinofaggiana
Copy link
Member Author

I don't know the form (h w) of original image, you yes ? how ?

@tobiasKaminsky
Copy link
Member

Why do you need to know the form (h/w) of original image?

@marinofaggiana
Copy link
Member Author

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 ... ?)

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Aug 6, 2018

@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

@tobiasKaminsky
Copy link
Member

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.

@kesselb
Copy link
Contributor

kesselb commented Aug 6, 2018

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 .

@marinofaggiana
Copy link
Member Author

@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.

@rullzer
Copy link
Member

rullzer commented Aug 6, 2018

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.

@rullzer
Copy link
Member

rullzer commented Aug 6, 2018

example:

<server>/core/preview?fileId=<FILEID>&x=<WIDTH>&y=<HEIGHT>&a=true&mode=cover
  • server: the sever you connect to
  • fileid: The fileid of the file you want an image for
  • width: desired with of your preview
  • height: desired height of your preview

That should give you workable previews.

@marinofaggiana
Copy link
Member Author

@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

@rullzer
Copy link
Member

rullzer commented Aug 6, 2018

@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

@marinofaggiana
Copy link
Member Author

yes thx

@marinofaggiana
Copy link
Member Author

@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 :

https://cloud.xxxxxxx.it/index.php/core/preview?fileID=00283798ocr6ct4odsi8&x=640&y=480&a=1&mode=cover

this not works.

Are you sure :
/core/preview?fileId=&x=&y=&a=false&mode=cover

@rullzer
Copy link
Member

rullzer commented Aug 7, 2018

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.

@tobiasKaminsky
Copy link
Member

your file id is the "remote id", wich is "fileId" (8 digit) + "serverId"
00283798ocr6ct4odsi8 -> 00283798 + cr6ct4odsi8 --> fileId = 283798

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Aug 7, 2018

@rullzer
Copy link
Member

rullzer commented Aug 7, 2018

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

@marinofaggiana
Copy link
Member Author

marinofaggiana commented Aug 7, 2018

no. :-)))

ok guys ... bye

@rullzer
Copy link
Member

rullzer commented Aug 7, 2018

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.

@MorrisJobke
Copy link
Member

Okay ... as this is a documentation issue we should close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants