mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
more on image uploading
This commit is contained in:
parent
e089b61b62
commit
fcf4964e3a
10 changed files with 346 additions and 72 deletions
63
ApiClient.js
63
ApiClient.js
|
@ -758,7 +758,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
* @param {String} userId
|
||||
* @param {String} imageType The type of image to delete, based on the server-side ImageType enum.
|
||||
*/
|
||||
self.deleteUserImage = function (userId, imageType) {
|
||||
self.deleteUserImage = function (userId, imageType, imageIndex) {
|
||||
|
||||
if (!userId) {
|
||||
throw new Error("null userId");
|
||||
|
@ -770,12 +770,71 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
|
||||
var url = self.getUrl("Users/" + userId + "/Images/" + imageType);
|
||||
|
||||
if (imageIndex != null) {
|
||||
url += "/" + imageIndex;
|
||||
}
|
||||
|
||||
return self.ajax({
|
||||
type: "DELETE",
|
||||
url: url
|
||||
});
|
||||
};
|
||||
|
||||
self.deleteItemImage = function (itemId, imageType, imageIndex) {
|
||||
|
||||
if (!itemId) {
|
||||
throw new Error("null itemId");
|
||||
}
|
||||
|
||||
if (!imageType) {
|
||||
throw new Error("null imageType");
|
||||
}
|
||||
|
||||
var url = self.getUrl("Items/" + itemId + "/Images/" + imageType);
|
||||
|
||||
if (imageIndex != null) {
|
||||
url += "/" + imageIndex;
|
||||
}
|
||||
|
||||
return self.ajax({
|
||||
type: "DELETE",
|
||||
url: url
|
||||
});
|
||||
};
|
||||
|
||||
self.updateItemImageIndex = function (itemId, imageType, imageIndex, newIndex) {
|
||||
|
||||
if (!itemId) {
|
||||
throw new Error("null itemId");
|
||||
}
|
||||
|
||||
if (!imageType) {
|
||||
throw new Error("null imageType");
|
||||
}
|
||||
|
||||
var url = self.getUrl("Items/" + itemId + "/Images/" + imageType + "/" + imageIndex + "/Index", { newIndex: newIndex });
|
||||
|
||||
return self.ajax({
|
||||
type: "POST",
|
||||
url: url
|
||||
});
|
||||
};
|
||||
|
||||
self.getItemImageInfos = function (itemId) {
|
||||
|
||||
if (!itemId) {
|
||||
throw new Error("null itemId");
|
||||
}
|
||||
|
||||
var url = self.getUrl("Items/" + itemId + "/Images");
|
||||
|
||||
return self.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json"
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Uploads a user image
|
||||
* @param {String} userId
|
||||
|
@ -839,7 +898,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
|||
return deferred.promise();
|
||||
};
|
||||
|
||||
self.uploadImage = function (itemId, imageType, file) {
|
||||
self.uploadItemImage = function (itemId, imageType, file) {
|
||||
|
||||
if (!itemId) {
|
||||
throw new Error("null itemId");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue