Replace external image url - servlets

I have an image link:
http://image.externaldomain.com/someimage.jpg
And I want to rewrite that image to be rendered as :
http://www.mydomainexample.com/images/someimage.jpg
Is this possible without downloading the image on the server and then stream it from my own server?

Related

AWS amplify not rendering image using the dynamic online url while local build render image correctly

Locally I got:
The deployed version I got:
I'm not sure why the service URL is added before the image URL.
And the wired thing is the dynamic url path does not load correctly while the static path works well.
I guess it might have to do with the path redirection so below is my setting:

Meteor SSR how to load images on localhost?

I'm generating a pdf on server-side using Meteor SSR and node html-pdf library.
My problem is I can't load images from localhost. I'm trying to get the path to the image using Meteor.absoluteUrl, like below:
var imageUrl = Meteor.absoluteUrl( 'images/logo1.png' );
which resolves to http://localhost:3000/images/logo1.png, when I access this url directly on the browser it return the image. But it doesn't load rendering the html with SSR.
If I image source for an external image it resolves.
Is it possible to render images from localhost using Meteor SSR?
Thank you.
Edit
It is working on the pdf, but it doesn't work if I send the html response to the browser like this:
response.writeHead( 200, {'Content-Type': 'text/html'} );
response.end( html );
You need to put your image in the public folder. The url you are aiming for is pointing to your public/images/logo1.png app folder.
if you need your image to be private, I advise you to choose, depending on your image size, a blob storing in the mongoDB or a gridFS storage (if your images can be bigger than 16mb), using collectionFS or file-collection packages.

How i can access (display) the picture stored on path outside the server?

I am developping an application where the user can create an account and his profil (name, phone number and a picture).
The problem is about the picture, when user upload the picture i store it on server disk directory (outside app context) and i save the path of picture in database.
I my app i want to display the picture i save on user profil page.
How i can access (display) the picture stored on path outside the server ?
I use Tomcat 7, Spring MVC 3.
You would not be able to show it using putting local server path in image source. The html image tag reads the path when rendered in a web browser and your web browser will not have access to local path on your server. You will either have to create you app URL, which returns you the stream of your image or place that image in some web server and create URL of that image accordingly.
If by outside server, you mean outside the server directory in a different drive, then try the absolute path of the pictures first. And then when you are confident your pictures can be displayed in your page, then try trimming the path and refreshing the page so you get the relative path needed.

ASP.NET Image Upload path is correct but image is not displaying

Actually i am trying to save the image in different project under the folder of images.Here i am getting the url is,
D:\Projects\ECF\SVN\Codebase\ListView\ASP.NET\Code\AdvanceListView\AdvanceListView\Images\Empimage.jpg
the above url is correct, because that uploaded images is saved in the above path.But not displaying after uploading.

How to display image that is located on another server on the network (ASP.NET)

I've got a ASP.NET site that's located on a local server (MY_SERVER). And one of the things it does is pull up tiff files which are located on another server (ANOTHER_SERVER). The location of each of these files is stored in SQL. I pull up each of these images and am supposed to display them. The problem is:
the files are not named with a tiff extension (does it matter?)
they aren't displaying at all.
I am using an Image control to display these images, and I'm not sure if it matters that the extension is not set (does the image control know the difference between an jpg and a tiff without the extension?)
I am guessing the images aren't displaying because they are not on the same server MY_SERVER that the images are located (ANOTHER_SERVER). Any ideas on how to fix this?
edit: actually displaying the tiff files were amazingly simple:
protected void Page_Load(object sender, EventArgs e)
{
Response.ContentType = "image/png";
new Bitmap(Request.QueryString["ImagePath"]).Save(Response.OutputStream, ImageFormat.Gif);
}
but because the images are located on ANOTHER_SERVER I still can't access them. I may just do a hack where I copy them to a local directory on MY_SERVER but there's gotta be a simple way to fix this. Anyone?
Are the images on ANOTHER_SERVER accessible via HTTP or are you trying to display them in an img tag using their UNC path?
Since web pages are viewed on client machines, the paths to resources (images/css/scripts etc) must be accessible from the client's machine. Even if they are accessible from the server, if they aren't accessible from the client they won't be viewable.
I suspect in this instance MY_SERVER can access the tiffs on ANOTHER_SERVER, however the path to ANOTHER_SERVER means nothing to the client accessing the page.
You will either need to read the image in from the disk and display it as an image using a customer handler, or expose the images on ANOTHER_SERVER via HTTP and reference them that way (which means the client must be able to directly connect to ANOTHER_SERVER).
Regardless of what tag you use, does ANOTHER_SERVER store the images in an internet accessible location? If not, you cannot serve them directly on the internet. You can try downloading the file with Response.WriteFile.
The <img /> tag is not meant to serve TIFFs. The QuickTime plugin is a free TIFF viewer, but it is not very flexible. Where I work, we use Atalasoft's dotImage, which converts TIFFs to tiled PNG on the fly, but it is not free. I found this CodeProject article. Even if you can transform the image into a web-friendly format, your server-side code might have to cache the file on the web server.
You should be able to display an image from another server if your img tag src is properly setup and the server is accessible. However, I don't believe that most browsers support directly viewing tiff files. There are a number of tiff viewers available (google it).
You might also try an <embed> tag and see if it does the trick (look here). The user's computer would have to know how to deal with tiffs.

Resources