HTML gevorderde |
|
Dank je voor deze opmerking.
Maar dit is toch de methode die je moet gebruiken...
Image image1 = Toolkit.getDefaultToolkit().createImage(theFile);
Dit is de methode die ik zelf vaak gebruik (dit is een buffered image)
<?php private BufferedImage createImage(String file)
{
URL theFile = null;
try
{
theFile = new URL(con.getCodeBase()+file);
}
catch (MalformedURLException e) {}
if (theFile != null)
{
Image image1 = Toolkit.getDefaultToolkit().createImage(theFile);
try
{
MediaTracker tracker = new MediaTracker(this);
tracker.addImage(image1, 0);
tracker.waitForID(0);
}
catch(Exception e)
{
...
}
BufferedImage bi=new BufferedImage(70, 70, BufferedImage.TYPE_INT_RGB);
Graphics2D big = bi.createGraphics();
big.drawImage(image1,0,0,70,70,null,this);
return bi;
}
else
{
return null;
}
}?>
<?php private BufferedImage createImage (String file) { URL theFile = null; try { theFile = new URL (con .getCodeBase ()+file); } catch (MalformedURLException e) {} if (theFile != null) { Image image1 = Toolkit.getDefaultToolkit().createImage(theFile); try { MediaTracker tracker = new MediaTracker(this); tracker.addImage(image1, 0); tracker.waitForID(0); } catch(Exception e) { ... } BufferedImage bi=new BufferedImage(70, 70, BufferedImage.TYPE_INT_RGB); Graphics2D big = bi.createGraphics(); big.drawImage(image1,0,0,70,70,null,this); return bi; } else { return null; } }?>
(de php-tags zijn even voor de kleurtjes) |