Display Image from Local path "c:\image.gif"
Hi Experts,
Is there anyway to display an image from local path i.e "c:\img.jpg".
I need to display an image from the path in Dialog(Screen) programming.
I need to do it using program not any other way...
Can anyone suggest me a method please.
Thanks
Regards
Naveen
Hi Naveen,
You'll have to create a custom control for this and perform coding like this:
data piccon type ref to cl_gui_custom_container.
data my_piccon type ref to cl_gui_container.
data my_pic type ref to cl_gui_picture.
data my_container type ref to cl_gui_container.
* invoking the static attribute of the class.
my_container = cl_gui_container=>default_screen.
create object piccon
exporting
parent = my_piccon
container_name = 'IMG_CON'
* STYLE =
* LIFETIME = lifetime_default
repid = sy-repid
dynnr = sy-dynnr
* NO_AUTODEF_PROGID_DYNNR =
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
create object my_pic
exporting
* LIFETIME =
* SHELLSTYLE =
parent = piccon
* NAME =
exceptions
error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
* Can be used to load the picture from the presentation server.
call method my_pic->load_picture_from_url
exporting
url = 'file://D:mydataPicturesMisc_pics 1fw1.jpg'
* IMPORTING
* RESULT =
exceptions
error = 1
others = 2
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
Similar Messages
-
Display Image from Local p"ath c:\image.gif"
Hi Experts,
Is there anyway to display an image from local path i.e "c:\img.jpg".
I need to display an image from the path in Dialog(Screen) programming.
I need to do it using program not any other way...
Can anyone suggest me a method please.
Thanks
Regards
NaveenWell you could use the HTML control - try program SAPHTML_DEMO1 and key in the c:\img.jpg to check it works for you... or the picture control as used in example SAP_PICTURE_DEMO.
Jonathan -
Hi,
I have a jpg image which is stored in the local system(not on the server).I have written an application from which I am not able to download the image from the local system.
I am using the following code but this code works only if the image is present on the server.
String file = "C:\Folder_Name\image.jpg";
final byte[] content = this.getByteArrayFromResourcePath(file);
final IWDCachedWebResource resource = WDWebResource.getWebResource(content, WDWebResourceType.UNKNOWN);
try
final IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(resource.getURL(), "WD_Filedownload", true);
window.open();
catch(Exception e) {
wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
private byte[] getByteArrayFromResourcePath(String resourcePath)throws FileNotFoundException, IOException
FileInputStream in = new FileInputStream(new File(resourcePath));
ByteArrayOutputStream out = new ByteArrayOutputStream();
int length;
byte[] part = new byte[10 * 1024];
while ((length = in.read(part)) != -1) {
out.write(part, 0, length);
in.close();
return out.toByteArray();
And for downloading the file or image from local system I need to put the file in \src\mimes\Components folder; Where as I want the file to be downloadable anywhere from the local file system. Is that possible?
Thanks
PravinPravin,
If you want to display an image existing elsewhere on the local machine, you need to upload it first (use FileUpload UI component), store it in a byte array and then continue with your code below of creating a cached web resource.
And you place resources in src/mimes/component so that they will be available to the application (meaning for all users). This doesnt mean you are displaying the image from the local file system. When you deploy, these images go and live in the server and accessed from there.
In any case, the hardcoded image location in your code is valid only for YOU but not necessarily other user running the same application.
As such, you cannot access the client's file system explicitly (i.e local machine) due to security reasons. I know of no other way to do it with WebDynpro. Any resources must be present on the server side at some point of time. Either at application start or ask the user to provide it (like FileUpload).
No web technology allows that other than signed applets or trusted activex controls, as far as i know.
Hope that clears the confusion.
Thanks,
Rajit
Message was edited by:
Rajit Srinivas -
Hi,
I'm using J2ME wireless toolkit, and I want to know is it possible to view image from local(eg. C:\WTK22\appdb\DefaultColorPhone\filesystem\root1). I've written some code to view form the folder but it appear "error: null".
mage storedImage = null;
String picLink = "file://localhost/" + currDirName + fileName;
try{
storedImage = Image.createImage(picLocation);
catch(Exception e){
System.out.println("Error here: " + e.getMessage());
}Yes, it is possible.
They were demonstrating the RT display at NI Week. It is part of the RT features of Vision 6.1. You can route an IMAQ display window to the video output on the PXI chassis. Anything you display in that window will show up on your screen.
Bruce
Bruce Ammons
Ammons Engineering -
How to load an image from local filesystem, and paint it to a frame
Please offer an AWT solution
Image getImage
String path
Image image = Toolkit.createImage(path);
loadImage(image);
return image;
void loadImage
MediaTracker mt = new MediaTracker(image_observer);
mt.addImage(image, 0);
try
mt.waitForID(0);
catch interrupted exception
class extends Panel
Image image
public void paint(
g.drawImage(image,
public void update(
paint(g);
public Dimension getPreferedSize
return size of image -
If you change the image mode of this image from 8-bit RGB image to Grayscale
mode while in PSCS – what will the new Pixel Count be?If you mean by Pixel count the number of pixels, this will not change. The image will have the same size thus the same number of pixels.
-
Hello,
I've installed B.O. XI 3.1 client tool on a laptop, but when I try to run Designer, or Deski the following error occurs (REPOSITORY ERROR (fileSystem::extract Blob From Local Path) file not found) and the application quits.
Anyone has an idea?Hi
What operating system are you using on your laptop?
I have a colleague having a similar problem using Windows Vista, whereas I am fine (using XP).
Did you manage to resolve this issue? (And if so, how)
regards, Lara -
How to read images from local hard disk and display in tile layout
Dear Folks,
I have 100 images in a folder @ local hard disk (E drive).
I would like to display them in Tile view of 3X3.
I have options (Radio buttons) to chnage the layout at runtime to 4X4 , 5#5 and 6X6.
Also when the change in layout happens, I wanted to make use of backgroudLoading of image view so that user do not want to wait till the entire tile loads.
How do I achive this requiremet?
Sample code if any of great help. Thanks in advance.
Edited by: JavaFX_Duo on Jul 9, 2009 12:02 PM1. So I would like to know which is the {color:#3366ff}best way to load local images in ImageView{color}.I'm no expert, but is there a reason that you are using Swing to do the loading?
2. secondly, currently the system displays all images only after the completion of creating all images. {color:#3366ff}How to display images as and when they are created.{color} So that the user has a feeling that the images are loading.JavaFX Image class let you display a lightweight placeholder, and you can bind the progress to some kind of visual indicator. I don't think you can display an image that is partially loaded.
def PATHS: String[] = [
"C://Ariel Atom//ariel-atom-1.jpg",
"C://Ariel Atom//ariel-atom-2.jpg",
"C://Ariel Atom//ariel-atom-3.jpg",
"C://Ariel Atom//ariel-atom-5.jpg"
function getImage(path: String): Image {
Image {
url: "file:///{path}"
backgroundLoading: true
Stage {
title: "Image Tiles"
width: 1024
height: 800
scene: Scene {
content: [
Tile {
columns: 2
tileWidth: 400
tileHeight: 400
content: for (i in [0..3]) {
ImageView {
image: getImage(PATHS) -
How to load images from different path
Hi,
i'm triying to load an image using the next code:
String path="C:/images/tv_on.gif";
java.net.URL imgURL =new java.net.URL(path);
img=Toolkit.getDefaultToolkit().getImage(imgURL);
but when it is compiled it returns MalformedURLException.
the image is in my local directory so i've tryed to define
path="file:///C:/images/tv_on.gif";
becuase the port and the local host name aren't needed.
Anyway it does not work.
I don't know how to load an image that it is in a file in a different path from the mainclass path
CAN ANYONE HELP ME?sorry to bother, similar like above, i tried many times on my computer to load a simple image in java application.. here's my code:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
public class View extends JFrame {
private URL imageURL;
private File file;
private Image sourceImage;
private String name, title, message;
private int width, height;
public static void main(String[] args) {
System.out.println( "Hello Eros!!!" );
View img = new View();
public View() {
name = "D:/shared/inputpic.gif";
file = new File( name );
Toolkit toolkit = Toolkit.getDefaultToolkit();
try {
imageURL = new URL("http://www.google.com.my/images/logo_sm.gif" );
} catch (MalformedURLException e) {
if ( file == null ) {
sourceImage = Toolkit.getDefaultToolkit().getImage( name );
System.out.println( file );
} else {
sourceImage = toolkit.getImage( imageURL );
System.out.println( file );
width = sourceImage.getWidth( this );
height = sourceImage.getHeight( this );
System.out.println( "Pixel = " + width + "x" + height );
if ( width * height == 1 ) {
title = "Greetings"; // Shown in title bar of dialog box.
if ( file == null ) {
message = "Unable to load the file " + name;
} else {
message = "Unable to load the link " + imageURL;
JOptionPane.showMessageDialog(null, message, title, JOptionPane.INFORMATION_MESSAGE);
}could anyone test this n give my the reason i couldnt even load the image -
Display image from BLOB field (png image)
Hello,
On my database i have a function which return BLOB (png image from a webservice)..
Is there some tutorial or sample code how to display a image froma blob field in oracle reports?
thank youYou can create a view and base your report on that view. The view would be something like:
create or replace view my_view as
select my_blob_function() image
from ...In your Report it would just be:
select image
from my_viewNow, I'm not sure if Reports supports png format, though.
There are many examples to be found, e.g.
http://download.oracle.com/docs/html/B10602_01/orbr_dyngraph.htm -
Get image from local file system for printing
If a user clicks Print, I would like to be able to print the
stationery header if the user wants to print on plain paper. Can I
pick up the image from the users local file system and add it
directly to the print send object? Prior to this the user would
simply upload the location of the image to the remote server where
the swf resides, or do I have to ask him to upload the image itself
and then download it again every time he uses the program?
DougHere is a snippet from the Flex 2 user guide about urlloader:
When using this method, consider the Adobe® Flash®
Player security model:
For Flash Player 8 and later:
Data loading is not allowed if the calling SWF file is in the
local-with-file-system sandbox and the target resource is from a
network sandbox.
Data loading is also not allowed if the calling SWF file is
from a network sandbox and the target resource is local.
As far as I know there is no way for a user to "trust" an swf
file. This is not like an activeX control. -
Resize image from local drive and upload to server
Hi there
I want to allow the user to chose an image from his local
hard drive.
The image should then be loaded into the Flex 2 application.
There I wanna show him infos about the image e.g. height and
width.
He should then be able to scale/resize the image and upload
it to the server.
I have no idea how to do that :-)
Any thoughts on that?
Thanks in advance
BerndWell in short, you need a second language to support that,
e.g. PHP/ASP/CF.
First you'll have to build a GUi in which you can upload the
jpg, putting it to the server using php/asp/cf, then you'll need to
make a call to that image, (importing it into your flex), then
you'll have to set the parameters for the resizing, then you'll
have to call a php/asp/cf script which does te resizing -
Images from web path won't show in Crystal Reports XI R2
Hi, I have a problem with my Crystal Report XI R2. I am trying to get images from web as well as static google map using OLE object. After setting the Graphic Location. No images are shown. I am using Windows XP SP3.
Also, I tried to create a simple report using same program and version installed in my Windows 7 Laptop. I inserted OLE object with graphic location from web like http://www.domain.com/image.jpg and it appears... same as with google static map with given latitude and longitude. And it works!
Is there any problem with my windows XP machine? any video card issue or dot net version issue or firewall issue?
Please help. ThanksTo add to Don's reply. Fiddler is a great HTTP sniffing utility that should be able to tell you what is happening as far as the permissions, etc., etc.
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter -
Use image from Aperture in Xcode image well
Is it possible to extract an image from Aperture and display this image in an Xcode image well?
I have a script that searches for and extracts a required image in the format:
image version id B4bCHCfeR969OQ7SEcUsOQ of library id LibraryFolder
I now want to display the image in an ApplescriptObjC project, how do I build a path to the image well?
Hope this makes sense, as usual, any help gratefully received.Frinton Fogey wrote:
I have been trying to use that same script but changing selcting an image to searching for an image but it won't work, please show me the error of my ways!
set theImage to "Image 1"
tell application "Aperture"
set ims to every image version
set names to {}
repeat with i from 1 to count of ims
set n to get the name of item i of ims
set names to names & n
end repeat
set imageSel to first image version whose name is theImage
export imageSel using export setting "JPEG - Original Size" to (path to desktop)
end tell
Giving this a closer look you could condense the script down to
set theImage to "IMG_08067"
tell application "Aperture"
try
set imageSel to first image version whose name is theImage
on error errTxt number errNum
display dialog "Error: " & errNum & return & errTxt
tell me to quit
end try
export imageSel using export setting "JPEG - Original Size" to (path to desktop)
end tell
You don't appear to be doing anything with the repeat loop or variables and you're always taking the first image you find with the name.
So here we look in the whole library for an image with the name and if we find it we export it. The try/error block is to catch times that the name you are looking for isn't in the library.
regards -
I want to download and image from the url and image is in byte format
hi
i want to download the image from the url:
http://www.tidelinesonline.com/mobile/j2me_v1?reqType=imageJoin&imageCount=1&month=1&day=1&year=2008&id=1&imageWidth=230&imageHeight=216&imageDepth=8&imageUnits=feet&imageType=JPG&msisdn=456
can any one help me to do this i need to finish this today plz help me.
first 5 character 09593 is the length of the image we need to substract image length from total length.
thanks in advance
M.Raj
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AM
Edited by: Mraj.Bangalore on May 15, 2008 12:01 AMhi
thanks for the reply,
that works only if .png file is there in the path.
i worked it out, it is working fine now
try
httpConn = (HttpConnection)Connector.open(url);
is=httpConn.openInputStream();
responseCode = httpConn.getResponseCode();
if(httpConn.getResponseCode() == 200)
ByteArrayOutputStream bStrm = null;
byte[] data = new byte[512];
int contentLen = httpConn.getHeaderFieldInt("Content-Length", 0);
if(contentLen > 0)
response = new byte[contentLen];
else
bStrm = new ByteArrayOutputStream();
int count = 0, tmp =0;
while ((count = is.read(data)) >= 0)
if( contentLen > 0 )
for(int i=0;i<count && tmp+i < contentLen;i++)
response[tmp+i] = data;
tmp += count;
else
bStrm.write(data, 0, count);
// if( aborted)
// break;
data = null;
System.gc();
if( contentLen <= 0 )
response = bStrm.toByteArray();
bStrm.close();
bStrm = null;
System.gc();
else
// main.showAlert("ERROR","Connection failed.Please access again later");
// main.changeToMain();
catch(Exception e){
response = null;
responseCode = 0;
// main.showAlert("ERROR","Connection failed.Please access again later");
// main.changeToMain();
catch(OutOfMemoryError e){
// main.showAlert("ERROR","Not enough memory, please disable some apps or delete files and try again.");
// main.changeToMain();
finally
System.out.println("Before Creation"+response.length);
img = Image.createImage(response, 5, response.length-5);
System.out.println("After Creation");
CanvasImageFile canvas = new CanvasImageFile(this);
midlet.display.setCurrent(canvas);
try
if( is != null )
is.close();
is=null;
catch(Exception ex){
// main.showAlert("ERROR","Connection failed.Please access again later");}
if( httpConn != null )
try {
httpConn.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
httpConn=null;
Maybe you are looking for
-
Group Permissions using External Table
I have a problem with using an external table for user group permissions. I am using OBI authentication but need to use an external table to manage the user's group permissions. I created two RPD groups, GROUP1 and GROUP2. GROUP1 has access to TABLE1
-
Help Needed to Install Photoshop CS6
Company bought product in 2012 and never installed. I opened the sealed package this morning and tried to install. It asks for a serial number. The only number I have is on the back of the box, it is 3 letters/3letters and then 8 digits. The seri
-
I tried with download.com and the drivers seem corrupted. And this model is listed on the apple website. Where can I find a reliable place to download this? I have a macbook pro. Thanks a lot everybody!!
-
Epson r2400 Driver Loses Functionality after Installing Digital Camera Raw
I have four Macs at home and two printers. After installing Digital Camera RAW Compatibility Update 2.0 from software update on my Mac Pro and MacBook Pro, the Epson r2400 printer driver no longer works. I can barely get a print out of Aperture and/o
-
Looking to create a random record repeat region where the random records being pulled updates a hit count. i.e. a simple banner rotator that counts how many times it's displayed. not all banners being rotated are in one folder... they are simply acco