Jump to content

escultor

Members
  • Posts

    2
  • Joined

  • Last visited

 Content Type 

Forum

Downloads

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Events

Profiles

Posts posted by escultor

  1. i found a way to do this, but is not working at all, still working on it:

    These are the step :

     

    Create a Class with the next code :

    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.logging.Logger;

    public class Images {

        private static final Logger log = Logger.getLogger("Images");

        public Images() {
        }

        public File convertBytes(java.io.InputStream objeto) {
            try {

                java.io.ByteArrayInputStream bais = (java.io.ByteArrayInputStream) objeto;
                String strBais = bais.toString();
                File file = new File("Foto.jpg");
                FileOutputStream fos = new FileOutputStream(file);
                int data;
                while ((data = bais.read()) != -1) {
                    char ch = (char) data;
                    fos.write(ch);
                }
                fos.flush();
                fos.close();
                return file;
            } catch (Exception e) {

                e.printStackTrace();
            }
            return null;
        }

     

    2.- Add the image and Change the "Expression clase to java.io.File"

    3.- In the "Image Expression" add new class.package.Image().convertBytes($F{FieldFromDatabase})

    4.- Add the jar if needed and dont forget to add the imports on your properties report.

    5.- Sometime is necesary to change the rigths where the image wil be allocated.

     

  2. i found a way to do this, but is not working at all, still working on it:

    These are the step :

     

    Create a Class with the next code :

    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.logging.Logger;

    public class Images {

        private static final Logger log = Logger.getLogger("Images");

        public Images() {
        }

        public File convertBytes(java.io.InputStream objeto) {
            try {

                java.io.ByteArrayInputStream bais = (java.io.ByteArrayInputStream) objeto;
                String strBais = bais.toString();
                File file = new File("Foto.jpg");
                FileOutputStream fos = new FileOutputStream(file);
                int data;
                while ((data = bais.read()) != -1) {
                    char ch = (char) data;
                    fos.write(ch);
                }
                fos.flush();
                fos.close();
                return file;
            } catch (Exception e) {

                e.printStackTrace();
            }
            return null;
        }

     

    2.- Add the image and Change the "Expression clase to java.io.File"

    3.- In the "Image Expression" add new class.package.Image().convertBytes($F{FieldFromDatabase})

    4.- Add the jar if needed and dont forget to add the imports on your properties report.

    5.- Sometime is necesary to change the rigths where the image wil be allocated.

     

     

     

×
×
  • Create New...