Ngx-editor "Choose Imagen" - ngx-editor

I have installed ngx-editor, but when trying to upload an image it does not leave me and gives an error, both with "jpg" and with "png".
They are files from my local computer, and they are small in size.
From what I see in the official example, it does not stop going up either, it gives me the same error:
https://ngx-editor.stackblitz.io/
ERROR:
Imagen endpoint isn't provided or invalid

Please see this documentation page.
You need to implement your own endpoint API, which should receive the file via HTTP POST, store it somewhere then return a JSON containing the url of the file saved to your server.

Related

Not able to convert .docx file to pdf using microsoft graph api

For my project need, I need to convert MS format documents in to pdf. I started exploring microsoft graph API. For easiness I started with graph explorer(using my corporate and personal login) on https://developer.microsoft.com/en-us/graph/graph-explorer.
I have added sample document in drive and using https://graph.microsoft.com/v1.0/me/drive/root/children, I got itemId of my file.
Now, I am trying to convert it into pdf using https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf. But I am always getting response as Failure - Status Code 0
Anyone has an idea how to fix this issue?
Here is an attached screen shot of microsoft graph explorer
Note: I found similar problem here but it is not solved
According to your description, I assume you want to convert .docx file to pdf using Microsoft graph API.
Based on my test, we can use https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf.
It will return a failure response when run it in graph explore. However, when we use the develop control panel, we can get this request and response.
Location properties are in the response headers. It is the address of the converted file.
We can use this URI to review or download the document that converted.
The request URL:
https://graph.microsoft.com/v1.0/me/drive/items/{itemId}/content?format=pdf
The response may like this:

Unable to set profile picture using Graph Explorer

I'm trying to update my profile picture using Microsoft Graph Explorer (v1.0) but I'm unable to do it, I'm always getting the following error :
An internal server error occurred. The operation failed., The file you chose isn't an image. Please choose a different file.
The problem is that the file I'm trying to update my picture with is an image inserted in the request body (a base64 representation of it, I used this site in order to get it: https://www.base64-image.de/).
I'm also using the header Content-Type with the value image/jpeg and I think that, as I'm logged, I don't need the authorization header.
The URL I'm using is: https://graph.microsoft.com/v1.0/me/photo/$value
This endpoint takes the raw image as input, not a base64 encoded version. From the documentation:
Request body
In the request body, include the binary data of the photo in the request body.
Since it isn't possible to stream a file like this using Graph Explorer, updating the photo isn't supported by Graph Explorer.

WOPI Host implementation, trying to render doc in iframe

I'm trying to get Wopi host implementation in Ruby on Rails application.
My domain is whitelisted under CSPP. Trying to get the file contents in iframe, but I just see "Word Online" and a loading gif, I return binary file contents of docx as response to ..wopi/files/:id/contents. I don't get any calls hitting my host server.
Sample wopi_src_url: https://word-view.officeapps-df.live.com/wv/wordviewerframe.aspx?ui=1033&rs=1033&dchat=false&IsLicensedUser=0&WOPISrc=https://sgdevwopi.test-wopi.sycamoreinformatics.com/wopi/files/31/contents?access_token=eyJhbGciOiJIUzI1NiJ9.eyJ1c2&access_token_ttl=160000000
Able to get the Wopi validation page in Iframe using .wopitest file. How should I proceed further? Or what am I missing? Please help.
Note: I'm using ngrok to make my local app server visible publicly with whitelisted domain.
I see to problems with your URL. You must ensure that
the URL is of the form http://server/<...>/wopi/files/(file_id) (so drop the /contents part - WOPI client will call the /contents endpoint automatically when necessary)
the WOPISrc parameter value is encoded to a URL-safe string
More info here and here.

Maximo 5.2 Can upload attachment to the server but can't view them on client side

Ok I know Maximo 5.2 is horribly outdated but currently I just want to get the attachment working. So here is the situation:
I have an old server (running 2000) with a folder being shared on the network with the name of F$. I have tried that the attachment uploading functionality works fine: users can attach any file to a work order and that file will be copied into a specified folder in the F: drive of the server. But when I try to access to that file from the client side -- that is, click on the link within the work order (from attachment tab in Maximo webapp) in order to view the attachment -- I get a 404 response. So in a way it's like I am able to write to the server but somehow I can't read or download it from the client side.
UPDATE:
I found out that after you've uploaded a file to the server, it can be accessed from the link http://servername:port/doclinks/drawings/filename from any other client side desktop in the browser. However within the Maximo web app, the webpage javascript automatically parse the link as http://servername/f$/MAXIMO/doclinks/drawings/filename -- It returns redundant part and withno port number. Is this returned link configurable through settings or do I have to dig into the JSP?
You need to set up virtual directory mapping on weblogic
http://docs.oracle.com/cd/E11035_01/wls100/webapp/weblogic_xml.html
The files are on the server. You just to correctly map the doclinks root on the file system to make it accessible to the web. You are getting a 404 error because the mapping is wrong.
In c:\maximo\applications\maximo\maximouiweb\webmodule\WEB-INF look for weblogic.xml
Add an entry:
<virtual-directory-mapping>
<local-path>/apps/maximo/</local-path>
<url-pattern>/doclinks/*</url-pattern>
</virtual-directory-mapping>
The entry above sits between <weblogic-web-app> and </weblogic-web-app>
The above example would mean your doclinks directory on the server is /apps/maximo/doclinks/
You would need to edit weblogic.xml, redeploy your maximo.ear along with your doclinks.
Because you are getting http://servername/f$/MAXIMO/doclinks/drawings/filename, particularly the f$/MAXIMO part, it tells me your F<PATH>\\MAXIMO\\doclinks = http://servername:port/doclinks mapping in your doclinks.properties is not correct. If you are on the Maximo host, via remote desktop or whatever, and you open Windows Explorer, what do you need to put in the address bar to access the attached documents folder? You said it's on F$, but F<PATH> in your properties file will translate into F:, not F$. So, you need to change your doclinks.properties
from: F<PATH>\\MAXIMO\\doclinks = http://servername:port/doclinks
to: \\\\servername\\F$\\MAXIMO\\doclinks = http://servername:port/doclinks

Error downloading file from a given URL

I am trying to download the given URL:
http://www.addic7ed.com/original/9521/7
but when i try to download the file using my Java Code:
URL url = new URL("http://www.addic7ed.com/original/9521/7");
ReadableByteChannel rbc = Channels.newChannel(url.openStream());
FileOutputStream fos = new FileOutputStream("abc.srt");
fos.getChannel().transferFrom(rbc, 0, 1 << 24);
The html page gets downloaded whereas the file to be downloaded should be a .srt extension file.
But when I try to download the above link using Internet Download Manager the file gets downloaded.
IDM converts the above given URL into http://www.addic7ed.com/srtcache/Supernatural/Supernatural%20-%2004x06%20-%20Yellow%20Fever.720p%20CTU.English.orig.Addic7ed.com.srt
So my question is how to achieve this in JAVA...?? Are there any API available to achieve this.
Have you looked at the HTML file? I suspect that it is actually an error page from the server, and that it contains clues about what is actually going on.
Here are some possibilities:
Maybe you need to supply authentication credentials.
Maybe the server is sending a redirect (3xx) response, and that the client side is not performing the redirect.
Maybe you need to set some extra headers to make the server realize that it should not turn the response as HTML. For example, an Accept header.
But note that the details will depend on the server that you are trying to talk to.
If I was trying to download files programmatically in Java, I would either use HttpUrlConnection or the Apache HttpClient libraries. Both will give you more control over the download process than simply using URL.openStream()
This is probably because the http response from http://www.addic7ed.com/original/9521/7 is a 302 redirect which your java code is not correctly handling. IDM correctly handles the redirect. A great tool to use if you are on a *nix based systme, or have cygwin installed on windows is curl.
curl -v http://myurl
will display all the http traffic information (request/response)
Have you tried with?
URL url = new URL("http://www.addic7ed.com/original/9521/7");

Resources