473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How Can I Display an Image from Another Site?

Hi,
This works:

banner = getImage(GetCodeBase(),"mypicture.jpg")
But, I tried variations of:

try {
url = new URL("http://www.my-other-website.com/mypicture.jpg");
} catch (Exception e){}

banner = getImage(url);

And couldn't get that to work.
Can someone tell me how to display an image from a website other than the
one the applet is on?
Thanks very much,
- Jeff
www.bikewebsite.com

Jul 17 '05 #1
3 2299
On Wed, 29 Sep 2004 03:23:52 +0000, Jeff Napier wrote:
This works:
banner = getImage(GetCodeBase(),"mypicture.jpg")
But, I tried variations of:

try {
url = new URL("http://www.my-other-website.com/mypicture.jpg");
} catch (Exception e){}

banner = getImage(url);

And couldn't get that to work.
Can someone tell me how to display an image from a website other than the
one the applet is on?


I could be wrong, but I thought the default security policy for Java
prevented an applet from accessing data other than from the site the
applet was delivered from. In that case, you'de need to look at how to
alter the security policy (if it can be done for an applet).

Tony
Jul 17 '05 #2
Jeff Napier wrote:
Can someone tell me how to display an image from a website other than the
one the applet is on?


You basically have three options:

1) Sign your applet so it get more privileges.
You need an expensive certificate to do that and your users will have to
confirm a dialog box.

2) Make a little gateway on your server. This can be done with two lines
of PHP code. Give the URL of the foreign image as an parameter to your
script en let the script fetch and output the image.

3) Use Dynamic HTML (you can call JavaScript form within your applet
with LiveConnect [netscape.javascript.JSObject]).

Edwin Martin.

--
http://www.bitstorm.org/
Jul 17 '05 #3
Edwin Martin wrote:
Jeff Napier wrote:
Can someone tell me how to display an image from a website other than the
one the applet is on?

You basically have three options:

1) Sign your applet so it get more privileges.
You need an expensive certificate to do that and your users will have to
confirm a dialog box.


This is a popular misconception. You can create your own certificates
for free using the tools from Sun. The difference is that user will see
that you issued yourself your own certificate and it did not come from a
third party.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tyrone Slothrop | last post by:
I am coding a site which involves uploading images. All of the PHP and display is OK but the client wants to be able to display the image thumbnail on the upload page and show the full image on...
7
by: DavidM | last post by:
Hello -- I would like to display a different logo on my website for different seasons of the month. I currently have a logo for Halloween, Thanksgiving, and December. Can someone tell me what...
3
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr +...
18
by: fishwick | last post by:
I haven't really done any css in quite a while, and am banging my head against the wall trying get the rudimentary layout together of a church website home page to display correctly - I don't want...
1
by: sneeka2 | last post by:
Hi, I'm developing a portfolio site, which contains a bunch of thumbnails wrapped in links: <a href="..."><img ... /></a>. A window.onload script inserts an onclick property into the links which...
1
by: mrquestions | last post by:
Hey, new to the forum, have looked everywhere for some information of the following query but can't find it anywhere... Within a site I am building a division calls on an include function to...
1
by: pkamil83 | last post by:
Hello I've got a table on SQL Server 2005 with columns: ID int Text XML Image varbinary(max) In this table I'm having SVG images. All I have to do is to display those images on ASP.NET 2...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
1
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.