You are not logged in.
To display image on one service I need not to download image, but to get URL of it.
For example, when I upload image, using /apirest.php/TicketFollowup/, I get such data:
Result
{
"id": 4929,
"message": "Document successfully coppied.",
"upload_result": {
"filename": [
{
"name": "6769e2bfdc2.50390467file.jpg",
"size": 127762,
"type": "image/jpeg",
"url": ".../glpi/files/6769e2bfdc2.50390467file.jpg",
"deleteUrl": ".../glpi/apirest.php?filenam=6769e2bfdc2.50390467file.jpg",
"deleteType": "DELETE",
"prefix": "6769e2bfdc2.50390467",
"display": "file.jpg",
"filesize": "124.77 Кб",
"id": "docfilename390767187"
}
]
}
}
But when I try to reach out to URL, I get an error 403 Forbidden. Can I use this URL somehow?
Or, for example, when I a document: /apirest.php/Document/13
I get data like:
{
"id": 13,
"entities_id": 0,
"is_recursive": 0,
"name": "Document Ticket 16",
"filename": "5249167656483939762.jpg",
"filepath": "JPG/b5/6438ae138b9d75dbf915904a224fd612543fb2.JPG",
"documentcategories_id": 0,
"mime": "image/jpeg",
"date_mod": "2024-12-24 07:35:43",
"comment": null,
"is_deleted": 0,
"link": null,
"users_id": 7,
"tickets_id": 16,
"sha1sum": "b56438ae138b9d75dbf915904a224fd612543fb2",
"is_blacklisted": 0,
"tag": "b5374ca4-d465cdb8-676a63c4e8aea5.77513487",
"date_creation": "2024-12-24 07:35:43"
}
Can I use filepath somehow?
Or uploading an image to service like Imgur and getting a URL from there is the only option?
Just for note: when I download document, I only get body which is image itself.
How can I get the url of image of document?
Last edited by little_devil (2024-12-24 12:22:39)
Offline
The more correct way is to download it. GLPI isn't an image/file hosting service so it isn't intended to allow access to files when not logged in. An exception exists for images and documents attached to an FAQ KB article, but only if anonymous FAQ access is enabled.
If you are authenticated and would have access to the document, then you can get the file through "/front/document.send.php?docid=DOCUMENT_ID" where DOCUMENT_ID is the ID of the Document item.
GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.
Offline
The more correct way is to download it. GLPI isn't an image/file hosting service so it isn't intended to allow access to files when not logged in. An exception exists for images and documents attached to an FAQ KB article, but only if anonymous FAQ access is enabled.
If you are authenticated and would have access to the document, then you can get the file through "/front/document.send.php?docid=DOCUMENT_ID" where DOCUMENT_ID is the ID of the Document item.
I tried it, it worked. It returned the body of image - an image itself, like if we downloaded it. Hmmm... The thing is.. I'm using a service like Flow XO, there are 2 actions: HTTP Requests and Send Photo. If I do HTTP request, I get all data: body, data, e.t.c. But the problem is that Send Photo action demands public url of photo. I guess, I can't use http-request as public URL, cuz' we have to send Headers, which I can't put into URL, as I remember.
Ohh.. I really don't know what I can do here.
I have an idea like: let's use some service for hosting: when we need, we'll upload an image there, we'll get a public URL, display in Flow XO, and then permenently delete it on this hosting service. But is it a good way? I think it's kinda.. silly. And is it even safe?
Offline