Insert and display images in a report
Hi ABAPers, I need to insert and display an image (bitmap format) in a standard ABAP report. With the consideration that the image (an employee photograph) could vary depending on the employee numer the user enter as an input parameter for the report. Any ideas of how can I do it? Help will be appreciated. Thanks in advance.
Regards.
Sebastian.
No you cant do it as Vashmi already said so , you can upload the pictures in ALV, but in your requirement I must say you should see the OSS note # 353949
<b>FYI</b>
Symptom
In the following note you will find some of the most frequently asked questions and their answers. Most answers are release independent, but some are valid for release 4.6 only.
Other terms
Questions, picture in header, profile, FAQ
Solution
[1] Question: Is it possible to configure the profile e.g. for a person?
[2] Question: How can I bring a picture of the person into the profile header?
[1] Question: Is it possible to configure the profile e.g. for a person?
Answer: It is possible to add or delete sub-profiles. You can do this in the customizing (transaction OOPF). There you can deactivate sub-profiles for an object type. Or add a new existing sub-profile.
<b>[2] Question: How can I bring a picture of the person into the profile header?
Answer:
You should have an employees picture with format JPG or BMP...
Start transaction OAAD to add the picture to SAP ArchiveLink. Press the Create-Button there. You have to type in PREL for the Business object and HRICOLFOTO for the Document type. Then press create. On the popup you must maintain the wished Personnel number for that the picture should be valid. Then press 'Continue'. Choose the picture and continue.
For the screen header 00 (if it isn't changed) you should see the picture in the profile.</b>
Hope thisll give you idea!!
<b>P.S award the points.</b>
Good luck
Thanks
Saquib Khan
"Knowledge comes but wisdom lingers!!"
Similar Messages
-
Upload and display image in webside
Hello Friends,
I am developing an auction web site ,and facing some problem so I need your help.
There is some confusion about uploading and displaying images in website .In web based
application if I want to upload images than where have to store the images database or server
side any folder .I have not idea about that please send your ideas and sussesions.
Second problem is What is the best way to display images in webside either giving a direct
path of server side image folder or I need to retrieve all images from database .
I have no idea about it please send me your guideline which are usefull for me to implement in my
website.
what is the correct way to upload and display images in website ?
Thanks . Have a nice day.If you are using a Container you just leave your image files in the home directory of your web application. And forget this idea about database. It´s not necessary in this case.
To display the images just use HTML, <img src="url">. -
Hi !
I have received a set of datas via rs232 and it contains picture messages. I have to decode the datas first and then display them on a canvas.
I have known several functions that may be used . Such as
int SetBitmapData (int bitmapID, int bytesPerRow, int pixelDepth, int colorTable[], unsigned char bits[], unsigned char mask[]);
int CanvasDrawBitmap (int panelHandle, int controlID, int bitmapID, Rect sourceRectangle, Rect destinationRectangle);
However,I don't know how to set the following parameters according to the actual pixel values and color values.
int bytesPerRow, int pixelDepth, int colorTable[], unsigned char bits[], unsigned char mask[]
What's more,I have no idea how to decode the datas.
The attachment is a incomplete project. I will be very appreciated if anyone could help me .
Best regards.
xiepei
I wouldn't care success or failure,for I will only struggle ahead as long as I have been destined to the distance.
Attachments:
Decode and display image.zip 212 KBWell, things are getting a bit clearer now.
1. Your image is actually 240x240 pixel (not 320x240 as you told before). The size of image data is 57600 bytes which corresponds to that frmat (I was puzzled by such a data size compared with larger image dimensions!)
2. The image is a 8-bits-per-pixel one; this means that you must provide a color palette to create the bitmap
3. You cannot simply copy image data into bitmap fields in CVI: CreateBitmap always produce an image with pixeldepth matched with display colour depth (normally 24 or 32 bpp)
All that means that you must:
1. Create the appropriate color palette with 256 colors: it may be a grayscale or color palette depending on camera characteristics. Grayscale palette can be found in my sample project, while sample colour palettes can be found here (here the description of a "standard" 8-bpp color palette)
2. Create the bits array correctly dimensioned for the color depth of your monitor
3. Get each pixel value from the camera, lookup in the color palette for the appropriate colour and create the RGB informations into the bits array in memory
4. Display the bitmap on the canvas
As a first step, I would configure my system for 256-color display setting, create a bitmap and simply copy image data into it: you should be able to get the correct image back to your screen.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
How can I get the date and time and display it on the report main page?
Gurus,
How can I get the date and time and display it on the report main page?
Thanks!Hello,
You can create a Formula Colum returning a date :
function CF_1Formula return Date is
begin
RETURN(SYSDATE);
end;
Put a Field in the Layout having this formula column as source .
Regards -
Dynamically fetch data from database and display it in the report
Hi,
We have a requirement in developing a report which needs us to dynamically fetch data from the database and display it in the report.
We have a column called WORKER in the report.
For each worker there is a measure(PSA) associated with it.
In the report we have to display both the WORKER and the PSA column.
What we want is, when we display the list of the workers, the corresponding workerid_id of the worker will be passed and the value of his PSA will be fetched from the database and displayed in the report.
Or anything similar to this.
We also have drill applied on this WORKER column. So after any drill up or drill down also the value for PSA should change.
Is there any way of doing this?
Please help if possible.
Thanks,hi,
data : count type i value 0.
data : Begin of itab occurs 0 ,
plan_version like hrhap-plan_version,
APPRAISAL_ID like hrhap-APPRAISAL_ID,
AP_START_DATE like hrhap-AP_START_DATE,
AP_END_DATE like hrhap-AP_END_DATE,
AP_STATUS like hrhap-AP_STATUS,
AP_STATUS_SUB like hrhap-AP_STATUS_SUB,
OBJ_DATE_SET like hrhap-OBJ_DATE_SET,
REVIEW_DATE_SET like hrhap-REVIEW_DATE_SET,
AP_DATE_SET like hrhap-AP_DATE_SET,
AP_DATE_EARLIEST like hrhap-AP_DATE_EARLIEST,
AP_DATE_LATEST like hrhap-AP_DATE_LATEST,
CHANGE_DATE like hrhap-CHANGE_DATE,
CHANGE_TIME like hrhap-CHANGE_TIME,
CHANGE_USER like hrhap-CHANGE_USER,
end of itab.
<b>select * from hrhap into corresponding fields of table itab.</b>
loop at itab.
write :/ itab-plan_version under 'plan_version',
itab-appraisal_id under 'Appraisal Id',
itab-AP_START_DATE under 'Start Date',
itab-AP_END_DATE under 'End date',
itab-AP_STATUS under 'Status',
itab-AP_STATUS_SUB under 'Substatus',
itab-OBJ_DATE_SET under 'Objective setting date',
itab-REVIEW_DATE_SET under 'Review date set',
itab-AP_DATE_SET under 'appraisal date',
itab-AP_DATE_EARLIEST under 'Earliest appraisal date',
itab-AP_DATE_LATEST under 'Latest Appraisal date',
itab-CHANGE_DATE under 'Change Date',
itab-CHANGE_TIME under 'change time',
itab-CHANGE_user under 'change user'.
count = count + 1.
endloop.
write : 'No of records' ,count.
rgds
anver
if hlped mark points. -
How to insert and view images from oracle using jsf
Can anyone please give me some code example or link of article explaining that how can i insert and view images to/from oracle using jsf?
Thanks in advance.You mean you want to view image data stored in the database, right?
Create a servlet that streams the image data to the response (setting the appropriate content-type), then reference this servlet in your img tag. Here is an example:
http://balusc.blogspot.com/2007/04/imageservlet.html
Storage is something different. What exactly don't you understand there? Perhaps you want a file upload component? -
Problem regarding insert and Display BLOB Image in Tabular form
I am trying to display and insert image in manual tabular form In Oracle APEX. but the image i uploaded was not inserted in wwv_flow_files table and in update button process i got "no data Found" Error...pls someone help me.... some part of code is bellow... SQL CODE IN REPORT REGION OF TABULAR FORM :- {
SELECT '#ROWNUM#' "SNO",
+' <img height="30" width="50" src="#WORKSPACE_IMAGES#'||F.FILE_NAME||'" alt="'||S.stud_fname||'" title="'||S.stud_fname||'" border="1"/>'AS "IMAGES", --- for display image from my table which is loaded through wwv_flow_files+
APEX_ITEM.CHECKBOX(01,s.stud_id) "DELETE",https:
s.stud_id|| apex_item.hidden(02,s.stud_id) "STUD ID",
+.......+
+.......+
union all -- for inserting row
SELECT '#ROWNUM#' "SNO",
+'<input type="file" name="F17" size="5">'AS "IMAGES", -- for display image+
APEX_ITEM.CHECKBOX(01,NULL) "DELETE",
null|| apex_item.hidden(02,null) "STUD ID", }
When i click on UPDATE BUTTON then following PROCESS CODE IS run :
FOR i IN 1..APEX_APPLICATION.G_F02.COUNT LOOP
IF APEX_APPLICATION.G_F02(i)IS NOT NULL THEN
UPDATE STUDENT SET stud_fname=APEX_APPLICATION.G_F04(i),
stud_addr =APEX_APPLICATION.G_F05(i), ......
ELSE
insert into FILE_ATMNT(ATMNT_KEY, ATMNT_NAME, FILE_NAME, MIME_TYPE, ATMNT_SIZE, CNTNT_TYPE, ATMNT_CNTNT, AUDIT_CRT_DATE ) SELECT id, name, filename, mime_type, doc_size,content_type, blob_content, SYSDATE FROM wwv_flow_files WHERE name = APEX_APPLICATION.G_F17(i);
SELECT id into upload_ref from wwv_flow_files where name =APEX_APPLICATION.G_F17(i);
........ ( code for student insert Record )
FILE_ATMNT is my attachment table in my workspace which updated through wwv_flow_files. My problem is that when i was click on update button image is not loaded into "wwv_flow_files" table so i didnt get image name bcz of $ name =APEX_APPLICATION.G_F17(i);$ this. so its show me no data found error.... Pls help meMahesh wrote:
Hi...i am mahesh...Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already).
You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should include:
<li>Full APEX version
<li>Full DB version and edition
<li>Web server architecture (EPG, OHS or APEX listener)
<li>Browser(s) and version(s) used
<li>Theme
<li>Template(s)
<li>Region/item type(s)
The best way to get help is to reproduce and share the problem on apex.oracle.com.
All code should be posted wrapped in tags<tt>\...\</tt> tags to preserve formatting and prevent it being interpreted by the forum software.
I am trying to display and insert image in manual tabular form In Oracle APEX. but the image i uploaded was not inserted in wwv_flow_files table and in update button process i got "no data Found" Error...pls someone help me.... some part of code is bellow... CODE IN REPORT REGION OF TABULAR FORM :-
SELECT '#ROWNUM#' "SNO",
'<img height="30" width="50" src="#WORKSPACE_IMAGES#'||F.FILE_NAME||'" alt="'||S.stud_fname||'" title="'||S.stud_fname||'" border="1"/>'AS "IMAGES", --- for display image from my table which is loaded through wwv_flow_files
APEX_ITEM.CHECKBOX(01,s.stud_id) "DELETE",https://forums.oracle.com/forums/post!default.jspa?forumID=137#
s.stud_id|| apex_item.hidden(02,s.stud_id) "STUD ID",
....... (some code).
union all -- for inserting row
SELECT '#ROWNUM#' "SNO",
'<input type="file" name="F17" size="5">'AS "IMAGES", -- for display image
APEX_ITEM.CHECKBOX(01,NULL) "DELETE",
null|| apex_item.hidden(02,null) "STUD ID",
....... (some code )
When i click on UPDATE BUTTON then following PROCESS CODE IS run :
FOR i IN 1..APEX_APPLICATION.G_F02.COUNT LOOP
IF APEX_APPLICATION.G_F02(i)IS NOT NULL THEN
UPDATE STUDENT SET stud_fname=APEX_APPLICATION.G_F04(i),
stud_addr =APEX_APPLICATION.G_F05(i), ..... ( some field of table)..
ELSE
insert into FILE_ATMNT(ATMNT_KEY, ATMNT_NAME, FILE_NAME, MIME_TYPE, ATMNT_SIZE, CNTNT_TYPE, ATMNT_CNTNT, AUDIT_CRT_DATE ) SELECT id, name, filename, mime_type, doc_size,content_type, blob_content, SYSDATE FROM wwv_flow_files WHERE name = APEX_APPLICATION.G_F17(i);
SELECT id into upload_ref from wwv_flow_files where name =APEX_APPLICATION.G_F17(i);
........ ( code for insert command )
FILE_ATMNT is my attachment table in my workspace which updated through wwv_flow_files. My problem is that when i was click on update button image is not loaded into "wwv_flow_files" table so i didnt get image name bcz of $ name =APEX_APPLICATION.G_F17(i);$ this. so its show me no data found error.... Pls help me
Before considering anything else, why bother with all this extra complexity? Why not use the standard form and report pattern? -
Display image in classical report
Experts,
Please share how to display image stored in SO10 in to a classical report??Hi
check this
In the transaction OAOR, you should be able to insert your company Logo.
GOTO - OAOR (Business Document Navigator)
Give Class Name - PICTURES Class Type - OT..... then Execute
It will show you the list, then select ENJOYSAP_LOGO.
On that list, you will find one control with a "create" tab.
Click std. doc types.
Select SCREEN and double-click.
It will push FILE selection screen.
Select your company logo (.gif) and press OK.
It will ask for a description- for instance: "company logo".
It will let you know your doc has been stored successfully.
You can find your logo under ENJOYSAP_LOGO->Screen->company logo.
Just run your ALV program, you should find your company logo in place of the EnjoySAP logo.
FORM TOP-OF-PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = HEADING[]
I_LOGO = 'ENJOYSAP_LOGO'
I_END_OF_LIST_GRID ='GT_LIST_TOP_OF_PAGE'.
ENDFORM. "TOP-OF-PAGE
Here 'ENJOYSAP_LOGO' will replace by ur created logo.
Refer this link
http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_enhanced.htm
http://www.sap-img.com/abap/alv-logo.htm
http://www.sap-img.com/fu002.htm
Re: Logo on Login screen
Re: To change image into main menu of sap
Regards
Anji -
How to insert a dynamic image in a report
Hi,
I want to insert the image of a student in a report toghether with all other student's data. The image's file name is in a field of the students' table and the file is stored in a directory of the web application. I am using Visual studio 2010 and the reports are prepared with Crystal Reports 2008 (full product). At design time, when I try to insert an image on the report, it immediately asks for an image file on the computer, so I cant figure out how to insert an image whose path and file name come from a data source.
Thank youHi Don,
As I said, when I insert any field in the report, say for instance the Student ID, and then link it to a database field containing the name of the image file to display (I have to concatenate the path to this file name as well), it first shows the report with the Student ID. If I click on it, because of the hyperlink defined at design time, it opens the file (an image in this case) in Internet Explorer, not on the report.
The same happens if I put an image as an object on the report at design time. In this case as soon as I put the image object on the report it forces me to select an initial image to show on the report. Anyway, I define an hyperlink for this image, pointing it to the image file of the Student, using the database field containing the image file name. When I show the report I see the initial image I was forced to use and when I click it, the hyperlink takes me to the right student image, but even in this case it shows me the right image opening an Internet Explorer session and not on the report. On the report the initial image is still there and never changes.
What I actually need is a way to put the student's image on the report as soon as it shows the other student's data, as the name, age, ***, and so on, without having to click somewhere to show the student's image.
Thanks -
Visual Studio 2005 - Display images in Crystal Report
I have been tyring to import an image from the HD into crystal reports. I have been failing miserably. I have researched the web and the forum and tired the approaches and still no luck.
I do not use a database and am using the crystal report that came with VS 2005 PRO. What version of CR do I have?
I have tried adding OLE object and still did not work.
Please advice!Hi Jerry,
What is the type of image you are trying to insert in Crystal reports ?
Have you tried using Insert--Image? You have to select the location of the image and place it in your report.
Is the image is located in your HD or pulling from network drive ?
Please try the following :
--Open your image in MS Paint
--Save the image as .bmp in your local HD Drive
--Insert the image directly or insert as OLE object.
Hope this will help you.
Thanks,
Sastry -
Can We Display Image on Hieararichal Report on Each Line item
Dear Gurus ,
I have a Strange Requirement from the Client . They want to display Image on each line item of report with regard to Material in Hierarchal Sequential Report . Is there any solution for the same .
Thanks in advance
regards
ShankarI am having a path which is stored in SAP database which i have fetched in the reported in both alv heriarchal and also in Alv Grid . The Image is stored from DMS . Now what i am doing is i am trying to load a excel file from program BCALV_BDS_UPLOAD and when i run my report and go to view and select Microsoft Excel option the I am getting an error Bad file format .
The Path is : SAPR3://SAPR3CMS/get/200/DMS_5FC1/DE72B28A5B76F0F1AF0000215E54283E/FM1E1085XX18W-001E.jpg
Can you please help me out in this .
Regards
Shankar -
Displaying image in abap report
Hi Everyone.
I need to display an image in a simple ABAP report giving the filepath of the image.
Can anyone suggest me how to do it???
Is there any FM for that, i need some solution.
Kindly help.
Thanks
Regards
NaveenI need to give the path of the image in the report itself and then while executing i must get the image in the output screen...
Giving path is a must.... -
ORA-01403 displaying image in a report
Hello.
I have a table with BLOB column that stores an image. I created a report on this table trying to display this column's images. I surround the column with dbms_lob.getlength() function in the SQL of the report and I use the following for the column's Number / Date Format in the "Column Formatting" section of the Report Attributes:
IMAGE:PROJECT:PRODUCT_LOGO:PROJECT_ID::::::inline:Download
This syntax is what makes things works for me in other areas of the application where I display stored images in a report. But not here. The report works, returning a number (representation of the getlength function returned value), as it should. As soon as I add the above Number / Date Format, I get:
report error:
ORA-01403: no data found
What is different in this report from the others that work is that this report's SQL is a join of a number of tables, not a straight select on one table like the others. In the SQL, the tables are referenced by alias, so table PROJECT's PRODUCT_LOGO column is referenced as a.product_logo in the query's select clause.
I don't see any other substantive differences.
What could be the cause of the failure?
Thank You
BorisThank You Scott for your reply.
I was able to figure it out.
In my report query, I forgot to reference PROJECT_ID, which is the primary key of the table by which the IMAGE mask is called. Apparently, it is necessary to awalys include the primary key in the query SELECT clause, where you actually need it in the report or not, just to make the image retrieval in the report work.
Thank You
Boris -
Open and display image in MVC layout
Hello!
I cant figure out how I shall do this in an MVC layout:
The program request user to open an image file that are then displayed in a JLabel
My setup at the moment resolve in a nullpointerexeption because it dont get any actual image file, but I dont understand what I have missed.
I can not post the whole code fo you to run because it is to big, so I post the part that are the most important. please have a look.
PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
//Variables
private ImageIcon picture;
//Method to get information of the selected file
PicturePanel (String fileName) {
picture = new ImageIcon (fileName); //Get the filename
int w = picture.getIconWidth(); //Get the image with
int h = picture.getIconHeight(); //Get the image height
//Set preferable size for the image (Use the properties for the selected image)
setPreferredSize(new Dimension(w, h));
setMinimumSize(new Dimension(w, h));
setMaximumSize(new Dimension(w, h));
//Method to draw the selected image
protected void paintComponent(Graphics g) {
super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}From my model:
//Local attributes
boolean check = false; //Used to see if a statement is true or not
PicturePanel pp;
JFileChooser fc;
int returnVal;
//newFile in File menu
public void newFile() {
//Open a file dialog in users home catalog
fc = new JFileChooser();
//In response to a button click:
returnVal = fc.showOpenDialog(pp);
System.out.println("You pressed new in file menu");
}From my controler:
//User press "New" in File menu
else if (user_action.equals("New")) {
//Call method in model class
model.newFile();
//Update changes
if (model.returnVal == JFileChooser.APPROVE_OPTION) {
System.out.println("Hello1");
File f = model.fc.getSelectedFile();
if (model.pp != null)
model.pp = new PicturePanel(f.getAbsolutePath());
System.out.println("Hello2");
//Display image (Here is line 83)
view.setImage_DisplayArea(model.pp);
System.out.println("Hello3");
}From my view:
//Sets the image to be displayed on the image_display area (Here is line 302)
public void setImage_DisplayArea(PicturePanel pp) {
image_display.add(pp);
}The complet error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.awt.Container.addImpl(Container.java:1015)You pressed new in file menu
Hello1
Hello2
at java.awt.Container.add(Container.java:351)
at View_Inlupp2.setImage_DisplayArea(View_Inlupp2.java:302)
at Control_Inlupp2.actionPerformed(Control_Inlupp2.java:83)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1882)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2202)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:334)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1050)
at apple.laf.CUIAquaMenuItem.doClick(CUIAquaMenuItem.java:119)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1091)
at java.awt.Component.processMouseEvent(Component.java:5602)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3129)
at java.awt.Component.processEvent(Component.java:5367)
at java.awt.Container.processEvent(Container.java:2010)
at java.awt.Component.dispatchEventImpl(Component.java:4068)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3936)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3866)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)Edited by: onslow77 on Dec 16, 2009 5:00 PM
Edited by: onslow77 on Dec 16, 2009 5:04 PMHello again!
Anyone that can help me figure out how to implement this in an MVC layout, I feel stuck.
I post a little program that open and display an image file so that you better can understand what I whant to do.
ShowImage
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import javax.swing.filechooser.*;
public class ShowImage extends JFrame{
//Variables
JFileChooser fc = new JFileChooser();
PicturePanel pp = null;
ShowImage () {
super("Show"); //Title
//Create the GUI
JPanel top = new JPanel();
add(top, BorderLayout.NORTH);
JButton openBtn = new JButton("Open");
top.add(openBtn);
openBtn.addActionListener(new Listner());
//Settings for the GUI
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setVisible(true);
class Listner implements ActionListener {
public void actionPerformed(ActionEvent ave) {
int answer = fc.showOpenDialog(ShowImage.this);
if (answer == JFileChooser.APPROVE_OPTION){
File f = fc.getSelectedFile();
//Check
System.out.println(f);
System.out.println(pp);
if (pp != null)
remove(pp); //Clean so that we can open another image
//Check
System.out.println(pp);
//Set the PicturePanel
pp = new PicturePanel(f.getAbsolutePath());
//Check
System.out.println(pp);
//Add PicturePanel to frame
add(pp, BorderLayout.CENTER);
validate();
pack();
repaint();
//Main
public static void main(String[] args) {
new ShowImage();
}PicturePanel
//Import Java library
import javax.swing.*;
import java.awt.*;
public class PicturePanel extends JPanel {
//Variables
private ImageIcon picture;
//Method to get information of the selected file
PicturePanel (String fileName) {
picture = new ImageIcon (fileName); //Get the filename
int w = picture.getIconWidth(); //Get the image with
int h = picture.getIconHeight(); //Get the image height
//Set preferable size for the image (Use the properties for the selected image)
setPreferredSize(new Dimension(w, h));
setMinimumSize(new Dimension(w, h));
setMaximumSize(new Dimension(w, h));
//Method to draw the selected image
protected void paintComponent(Graphics g) {
super.paintComponent(g); //We invoke super in order to: Paint the background, do custom painting.
g.drawImage(picture.getImage(), 0, 0, this); //Draw the image at its natural state
}//The endEdited by: onslow77 on Dec 16, 2009 7:30 PM -
Efficiency of decoding and displaying image files?
BRIEF SUMMARY
My question is this: can Flash Player download JPG and GIF
files from a server and rapidly open/decode them, ready for
display, efficiently and
entirely 'in memory'?
Would Flex be a good choice of language for developing a RIA
that needs to continually download lots of JPG and GIF images
on-the-fly from the server and render them on the screen? I *don't*
want my application to thrash the hard disc.
BACKGROUND
I am designing a 'rich' web app, and I'm investigating
whether Flex is the right tool for the job.
Although Flash's animation features are an obvious selling
point for implementing my user interface, I also need to do some
server-side rendering. What I want to do is perhaps a little
unorthodox: I will be generating lots of GIF and JPG files on the
fly and these will be streamed to the client (along with other
application data, e.g. in XML format) to update different parts of
the on-screen document. In need this to happen very quickly (in
some cases, creating the effect of animation).
It happens that JPGs and 16-colour GIFs will be, by far, the
most efficient formats for streaming the images, because of the
nature of the application. I could of course send the images in
some proprietary format, geared for my application, but presumably
decoding the images would be slow as I would have to implement this
myself in ActionScript, and so I would be limited by the speed of
Flex 'bytecode'. (I realise Flash is a lot more optimised than it
once was, but I am hoping to see a gain from using image formats
that Flash natively understands!)
Naturally the internet bandwidth should (in principle) be the
bottleneck. However, assuming I can get my image files to the
client on time, want I want to know is:
how efficient is Flash at loading such files?
Bearing in mind that I'm not just displaying the occasional
image -- I will be doing this continuously. Most of the images
won't be huge, but there will be several separate images per
second.
The image files will be a mixture of normal colour JPGs and
4-bit colour GIFs (LZW-compressed). I know that Flash natively
supports these formats, but depending on how Adobe have implemented
their LZW/Huffman decoding and so on, and how much overhead there
is in opening/processing downloaded image files before they are
ready to 'blit' to the screen, I imagine this could be pretty fast
or pretty slow!
If my client only has a modest PC, I don't want the JPG/GIF
decoding alone to be thrashing his CPU (or indeed the disc) before
I've even got started on 'Flashy' vector stuff.
I'm new to Flash, so are there any 'gotchas' I need to know
about?
E.g. Would it be fair to assume Flash Player will do the
decoding of the downloaded image entirely 'in memory' without
trying to do anything clever like caching the file to disc, or
calling any libraries which might slow down the whole process? It
would be no good at all if the images were first written to the
client's hard disc before being ready to display, for example.
Further, if I'm doing something a little out-of-the-ordinary,
and there is no 'guarantee' that images will be loaded quickly,
what I'm doing might be a bad idea if a later version of Flash
Player may (for example) suddenly start doing some disc access in
the process of opening a newly downloaded image. So, while I could
just 'try it and see', what I really need is some assurance that
what I'm doing is sensible and is likely to carry on working in
future.
Finally, I imagine JPG/GIF decoding could be something that
would vary from platform to platform (e.g. for the sake of
argument, Flash Player for Windows could use a highly-optimised
library, but other versions could be very inefficient).
This could be the 'make or break' of my application, so all
advice is welcome! :) Thanks in advance.You need a servlet/jsf component to render the image in the response.
Look at this: http://www.irian.at/myfaces-sandbox/graphicImageDynamic.jsf
Maybe you are looking for
-
Help: Oracle 8.1.7 on Mandrake Linux
I was able to get through the installation process. But I am currently stuck with initial database creation stage. Whenever I try to create a database with dbassist, I got the following error: ORA-03114 not connected to ORACLE ORA-03113 end-of-file o
-
File-splitting based on content.
Hi Experts, This question is regarding file-splitting. Its a BAI2 file with multiple records in it. a)I need to split the file based on an identifier and make those many sub-files ( with header and trailer added to the file ) b)And can we ensure we h
-
Flash reading binary from a database
i'm storing videos and images inside a blob in mysql and i need to have flash 8 read the files. right now i'm querying the database using php and then converting the php page to xml and then flash is parsing the xml. i need any feedback i can get. th
-
We have an application that requires only Microsoft Java VM be running in our IE browsers, so we cannot run Sun Java VM at the same time. Is there a workaround that will allow users to view Discoverer output? I am still investigating utilizing Discov
-
Can't use the trial on my brand new account
So recently I downloaded Flash Professional on my new account ([email protected]) and it says trial expired, I am confused as this is a brand new account on which i downloaded flash yesterday, Any help?