I have code which creates an image in an application server and that image has been referred in mail html. After sending mail, image will be deleted in application server. When I open the mail, the image is not getting displayed in the mail.
I think my code is deleting the image before it is copied to the mail server. I have checked by deleting the image manually.
First I opened the mail (this time image gets copied to mail server) and then deleted the image in application server. When I open the mail 2nd time, image gets display (because image is in mail server I guess).
Again I ran the code, this time before opening mail first time. I deleted the image in the application server and opened the mail. Image is not displaying (because image not getting copied to mail server).
I cannot add the image as an attachment, as per my requirement.
If you can't attach the image then you have to ensure than whatever external img src is being referred to (e.g. <img src="http://foo.com/bar.jpg"/>) remains accessible as long as people could reasonably view the message.
If the image is referred to in the mail as an external http resource, then it will be visible as long as it is available on the server.
You can, indeed, attach the image to avoid this problem, but those are the only to options I know.
You say that the image is "referred to" in your mail?
The img tag will contain a link (src) to you image. Your image must be at this location when the mail is viewed.
If you're deleting the image from this location then obviously it can't be displayed.
Related
I'm new in web development (spring-mvc), my background is from android world. I'm receiving images from service every 2 second, than I'm saving them to the WEB-INF/images folder, at this time every 1 second, I'm making ajax request to retrieve and display received image.
This is how I'm making ajax call
function updateImage() {
$.get('/api/getCurrentImagePath/', function (frameImagePath) {
$("#targetImgView").attr("src", frameImagePath);
setTimeout(updateImage, 1000)
})
}
My problem is that, when function is invoked $("#targetImgView").attr("src", frameImagePath);
console logs http://localhost:8080/images/13456482154.jpg 404 not found error
but received image path is correct.
How can I resolve this issue? or is there any better way to do, what I'm trying to do?
P.S
when I save images into the webapp/images folder during the running server and trying to set the path of images it does not works, but if I restart the server and statically set the path of already saved images it works
In Spring MVC, we have to options to display images
From another FTP server
From within EAR, to do so you can open images placed inside resource folder
Add this entry in dispatcher-servlet.xml
<mvc:resources mapping="/image/**" location="/resources/images/" cache-period="0"/>
You need to put images in your webapp/resources/images folder. After that access the image contextPath/image/imageName.jpg
I am facing a problem.
Is it possible to the save attachment file (.pdf and etc) from gmail to my application. After saved, the file will run directly from my application. After clicked save button in red circled, I wanted to run my application after attachment is saved in my download folder.
Note: I already able to download attachment into download folder.
I have a requirement to load big images into chrome browser, in pieces from the server and after it finishes downloading the file completely, if the user wants to look at the file again, then the browser should load it from its cache.
I have done the following to achieve this:
I have written a HTML file and I will be displaying the big image using 'img' tag.
Whenever the user requests for the image file, I'll make a HEAD request to the server enquiring about the content-length and last-modified-date.
The server replies back with the information based on the request and I divide the size of the file into 10 pieces and then make 10 sequential requests to fetch the image file. (Using for loop).
After chrome downloads the entire file and the next time user wants to look at the file, then I am making chrome to send If-Modified-Since query to the server.
If the server responds back with the code 304, then chrome will understand that it has to fetch the file from its cache.
I am facing the following problems:
1. I am getting about 100 bytes per response. Where should I store it and how should I make my img tag understand that it the client is still downloading the file.3
2. How should I recognize the file from the pool of files present in chrome's cache ?
3. The next time someone comes to view the same image, from where should I display the content from ?
Please Help. Can anyone also provide me with some example code or a link to some sample code.
Thanks and Regards,
Akshay Sahu
I got the way to perform this operation.
I am downloading all the bytes of a file in range and using File API of HTML 5 I am creating a file in the user HDD. Therefore, experiencing a complete resume download experience.
Thanks and Regards,
Akshay Sahu.
I've got some Java Applet that I'd like to use to upload file/files to FTP server. Most important method is upload( String ftpServer, String username, String password, String filePath, File sourceFile ).
In JS code I've got stored in array data grabbed from input="file" (user can attach and remove files to different objects he created before, so I have to store this data somewhere).
The problem is that file data is represented by JS File object, when calling upload function is recognized as sun.plugin2.main.client.MessagePassingJSObject (same thing when trying to initialize new java.io.File object).
So questions are:
is there possible to pass somehow object compatible with java.io.File or data about file (I guess only the fullpath) to Java applet ?
if not is there a way to upload from Java code file readed with FileReader to String (for example with .readAsBinaryString method) ?
or if exist any other solution for my problem ?
Edit:
A little more context:
Ftp upload applet is a part of application that uses canvas element (and fabric.js library to be specific). User after adding new elements to canvas area can choose an element and add/assing some files to that element (any image files). Images don't have to be load into canvas area, just their names should appear on a list below canvas when specific element is selected. Of course they can be removed as well.
After user confirms that he finished some data is send (post) to server-side to prepare a control file, than upload this file to ftp server. The only information about selected files required in control file are filenames, so I think it's possible to add file chooser to applet instead JS code, than send that data from applet or pass it to javascript and than send. Before or after posting control file data all files selected by user should be also uploaded to ftp server.
Unfortunately, there is one case when a file have to be loaded into canvas and send to ftp server as well after confirmation - background image file.
I don't know any ways to pass HTML5-created ArrayBuffer to applet via Live Connect, but it is possible (and probably slightly more cross-browser compatible) to spawn Java file chooser and read file from disk, using applet (with JNLP FileOpenService you can do it without signing applet).
I'm sending emails with embedded images through java class and in iPad2 the email client shows the body information correctly, except that repeats again the images embedded below the body (it seems that attach them). The images are .png instead o .jpg.
Does anyone have any idea about this problem?.