Image rotator from database

I want to display a couple of rows that will sow about 4 images per row. But images need to be rotated every time the page is refreshed, and the images come from links on the database. Any help will be appreciated. Thanks

This might get you started with the basics
Dynamically populating a JavaScript image slideshow
Here's another one using Bootstrap, PHP and MySQLi *improved*.
http://www.phpgang.com/dynamic-image-slider-using-twitter-bootstrap-php-with-mysql_471.htm l
Nancy O.

Similar Messages

  • Jasper report on HTML when one image loaded from database and for the other

    How to generate jasper report on HTML when one image loaded from database and for the other we give a image path
    My code
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
              exporter = new JRHtmlExporter();
              exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
              exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);
              exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, strImageInputDirectory);
         exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strImageOutputPath == null ? "." : strImageOutputPath);
         exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE);
         exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);
         exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
              exporter.exportReport();
              byte[] bdata = ((ByteArrayOutputStream) baos).toByteArray();
    Can any one help pls
    Message was edited by:
    ameet.au

    hey sorry for posting it in this forum.
    but do u have sample code for making it work.. since i am able to do it on PDF format(image from Database and another stored in the webserver) using
    byte image[] =(byte[]) outData.get("image");
                        ByteArrayInputStream img = new ByteArrayInputStream(image);
                        hmimg.put("P_PARAMV3", img);
    print = JasperFillManager.fillReport(reportFileName, hmimg, jrxmlds);
    bdata= JasperExportManager.exportReportToPdf(print);

  • Getting image path from database( Remote server)  & display in jsp page

    hai frnds,
    i have one doudt regarding in my web application Development
    . I want to Getting image path from database( **Remote server**) & display in jsp page here iam forwarding my control through Servlets
    how this will passiable
    Thanks in Advance
    SonyKamesh
    [email protected]

    hai
    I think ur doubt will be...
    1) Getting a Image From Remote Server( & U stored a only path name in Data Base)
    2) Image r stroed in saparate Drive( Not in Webroot-- where u Created domine )
    Please Any Help Will be Appriciated
    [email protected]
    Edited by: Sonykamesha on Dec 18, 2007 11:02 PM

  • I find that after updating my ipad to ios8 banking applications to deposit funds no longer work. The camera image rotates from horizontal to vertical and cannot be corrected. Is this a new ios8 error. I tried two different bank applications for ipad.

    I find that after updating my ipad to ios8 banking applications to deposit funds no longer work. The camera image rotates from horizontal to vertical and cannot be corrected. Is this a new ios8 error. I tried two different bank applications for ipad.

    Hi, Thanks for that further bug description In Your Last Message That Describes The Problem I Am Having perfectly and is exactly the same for me.
    unfortunately that fix for my camera Powershot G6 does not work or apply as the view pictures switch is different on G6 is not usable during download as once you plug in DC/USB cable it turns off, and makes no diff and problem still exists exactly as you just described.
    thanks anyways "Selz Boy"
    it has been 17 days since apple promised to get back to me within 3-5 days hopefully with a solution, but I have still not heard from them.
    They blew me off, i guess, probably i will have to wait for new Yosemite OS update, which they pre-warned me could take as much as 6 months.
    I cannot believe apple released this new update with such major bug issues for camera downloads and that horrible "Photos" pgm which has all sorts of downgrades in features, usefulness and new bugs compared to iPhotos which I just finally got used to and was much better software.
    I am starting to lose faith in Apple and I am getting that Microsoft "FEEL" like I used to have when I was a PC user, which was why I originally switched to Apple  computers in first place.
    Oh well got my fingers crossed here.
    Thankfully the memory card reader solution  is working well, but cost me $45.

  • Problem Populating Image Item From Database

    Hi All,
    I am using Oracle 9i & Forms 6i on Windows platform & working in client/server model. I created a form in which, I am reading an image file from the file system & then saving it into the database. In the Databse, i created the column as BLOB. But, when I query, this does not retrive the saved image in Image Item. But image is actually saved. When I tried, changing the database column to LONG RAW, it is working. I mean its reading the image in the image item from the database.
    Can anyone pls tell me, is there any problem like this, as we can retrive from LONG RAW but not from BLOB, or I am missin something here.
    Regards

    Hi,
    I use Forms 6i to save and retrieve image in BLOB column without problems.
    Some weeks ago, my column was long raw and I update it without problems. Nothing to do in Forms and juste modifiy query and recompile in Reports.

  • Issues with Image rendering from Database

    Maestros,
    I have an issue here that I working but can hardly find a plausible solution and would like some help from the community. I'll do my best to explain the my issue in detail that way those of you who are savvy in this domain can jump on it right away.
    I am in the process of implementing a shopping grid where products are shown as items on the grid. Each grid contains a custom product tag that contains a product image thumbnail, the description and price. All picture images are stored in a postgres sql database as byte arrays. I retrieve and rendered them on the product grid using a servlet that calls my product service.
    The problem I am having is that when products are rendered not all the images are rendered even though they are present. One a refresh is done, some of the ones that previously did not render on renders and some that did go missing. I am using jsf and it looks like the application reaches the render response phase before the images are completely retrieved. I am also implement hibernate ehcache to see if that can help solve the problem, to no avail.
    Is my approach the right approach? I know some of you would want to ask why I save images in a database and if you really want to know, the reason is because products are loaded dynamically and one product can have as many images as the e-shop manager wants. If please have another way to solve this problem please feel free to let me know. I am sure there is a better way of retrieving those images and render them without any issues and if you have done anything like that before feel free to send me some directions.
    Thanks
    Edited by: user10444142 on Oct 7, 2010 5:55 AM

    Intermittent problems are often a result of interference. Interference can be caused by other networks in the neighbourhood or from household electrical items.
    You can download and install iStumbler (NetStumbler for windows users) to help you see which channels are used by neighbouring networks so that you can avoid them, but iStumbler will not see household items.
    Refer to your router manual for instructions on changing your wifi channel or adjusting your multicast rate.
    There are other types of problems that can affect networks, but this is by far the most common, hence worth mentioning first. Networks that have inherent issues can be seen to work differently with different versions of the same software. You might also try moving the Apple TV away from other electrical equipment.

  • Image reclaim from database ,facing problem

    I am very much new in Flex development.........
    I am facing a problem from  quite a few days to  reclaim  a image from the database with the help of servlet to a flex application .  I am  using HttpRequest Object not  Blaze Ds.
    Actually image byte stream is comming back from Servlet to Flex   End  , but when I want to display it , then it shows the place of the image as black .I think image pixel's are not combining togather ..........Have you any Idea?
    I am trying in  the following way.......... this is in the result handler method................
    private function getPhotoResultHandler(event:ResultEvent):void{
                   try{                     
                              xmldata1=event.result as XML;   
                              mx.control.alert.show(xmldata1.toString);        //  Here I can see the  byte stream  in the browser                                                          
                              var byteData : ByteArray;                                                                                            
                              var dec : Base64Decoder  = new Base64Decoder();              
                              dec.decode(xmldata1.toString());                 
                              byteData = dec.toByteArray();                     
                              imggetPhoto.source=byteData;  
                catch( ex : Error )
              Alert.show( ex.message );

    Hi,
    I use Forms 6i to save and retrieve image in BLOB column without problems.
    Some weeks ago, my column was long raw and I update it without problems. Nothing to do in Forms and juste modifiy query and recompile in Reports.

  • How to get images dynamically from database without file paths in the table field

    I have a MS-Access database. I am working with ASP.NET. In the database there is product table in which I have "CodeNo" as a field which is a text field, and the product codes like "SM-R-2035". I also have another field "Image" which is also a text field and which have a file path in it corresponding to the particular product Image (e.g. Images\Products\SM-R-2035.jpg). So far every thing is ok. I have to update this site very frequently and lots of images are added each and every time. Its a tedious work to type the paths and file name every time and it also take a lot of time.
    What I am asking is : Is it possible to get images from a specific folder at runtime which is referenced by the "code no" itself and not the file path from the database. (Say at run time the "code no" is referenced from the database and the corresponding image is loaded dynamically from the specified folder). In other word I want to avoid the tedious work of typing.
    Can any one help with this issue. Any other simple suggestions are welcome.

    All you need to do is simple concatenation to obtain the path for the image file.  You didn't mention whether you are using VB.Net, C# or some other language to do your coding.
    If the code in your database is SM-R-2035, the file name is SM-R-2035.jpg and the path to the images foilder is Images\Products\SM-R-2035.jpg, Conceptually here is what you need to do:
    dim code_var
    dim path_var
    code_var = the code you obtain from your relevant field in the database
    path_var = "Images\Products\" & code_var & ".jpg"
    Now path_var is what you would call to obtain the image from your images folder.

  • Retrieval of image (Blob) from database - doesn't always work in JSP - Why?

    In my JSP pages, when an image needs to be retrieved, I direct <img src> to a servlet that handles image processing.
    As an example, if I have 30 products that need to be shown on 1 webpage, there will be 30, dynamically generated, <img src="go.imageServlet?id=a1"> tags/statements. The servlet, when called, will make a connection to the database, run a query for the image requested (fetched as type Blob), image displays in <img src> area of JSP page, and finally the ResultSet, Statement, and Connection object(s) are closed.
    I tested this out, and unfortunately, to my surprise, and disappointment, a few images did not display on the page. Though the images are in the database table. I'm a little lost as to why this problem is occurring.
    Can someone please shed some light on this for me?

    evnafets wrote:
    If you request just one image, does that image come back broken, or is it different images that are 'broken' each time?On a page of almost 30 image requests (thumbnail size), it varies, but typically, 1-3 images are 'broken' each time. And they are not always the same images. Very strange.
    There may potentially be thread concurrency errors depending upon how you have written your servlet - ie one request for an image interfering with another because they use the same variable.
    To make it threadsafe, in your servlet make sure that you only use variables local to the doGet/doPost method, and not any class attributes.In my JSP page that makes the requests for these images, a String array generates the <img src> tags on the page, as a very basic example :
    <%  for(int i=0; i<products.length; i++) {
    %>
          <img src="go.imageP?imageNumber=<%=products[[0]%>">
    <% }//for %>
    Sorry for not posting code snippets from my servlet in my first post of this topic....
    Here is my servlet snippet -     public class ImageProcessingServlet extends HttpServlet {
              public Connection conn = null;
              public ResultSet rs = null;
              public Statement stmt = null;
              public PreparedStatement pstmt = null;          
              public PrintWriter out = null;     
              public String siteNameReference = "";
              int maxFullSizeImageWidth = 600;          
              int maxSizeImageWidth = 300;
              int maxSizeThumbWidth = 140;
              int maxImageFields = 4;
              String errorMessage = "";               
              public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
                   doPost(req,res);
              public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
              try {                       
         HttpSession session = req.getSession();
         siteNameReference = req.getParameter("snr");
         String process = req.getParameter("process");
         if(process == null) process = "";
                   Context ctx = new InitialContext();
              if(ctx == null )
    throw new Exception("Boom - No Context");
              DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/imageDB");
         conn = ds.getConnection();
         stmt = conn.createStatement();      
              rs = stmt.executeQuery("Select "+imageNumber+" from images");
              rs.next();
              Blob blobImage = rs.getBlob(1);               
              getImage(blobImage,"thumb",res);
              if(rs != null) { rs.close(); }
              rs = null;
         if(stmt != null) { stmt.close(); }
         stmt = null;
         if(pstmt != null) { pstmt.close(); }
         pstmt = null;
         conn.close();
         conn = null;          
              }//try
         catch (Exception e) { }
         finally {
                   if (rs != null) {
                   try { rs.close(); } catch (SQLException e) { ; }
                   rs = null;
                   if (stmt != null) {
                   try { stmt.close(); } catch (SQLException e) { ; }
                   stmt = null;
                   if (pstmt != null) {
                   try { pstmt.close(); } catch (SQLException e) { ; }
                   pstmt = null;
                   if (conn != null) {
                   try { conn.close(); } catch (SQLException e) { ; }
                   conn = null;
              }//finally
         }//post          
              public void getImage(Blob blobImage, String imageType, HttpServletResponse res) {
                   try {                                              
                        //imageType will = Super = 600
                        // = Large = 300
                        //               = Thumb = 150
                        res.reset();
                        res.setContentType("image/jpeg");
                        BufferedInputStream bis = new BufferedInputStream(blobImage.getBinaryStream());                    
                        BufferedOutputStream bos = new BufferedOutputStream(res.getOutputStream());                                                            
                        if(imageType.equals("super")) {
                        byte[] imageBytes = new byte[(int)blobImage.length()]; //picture size           
         int length;
         while((length = bis.read(imageBytes)) > 0) {
    bos.write(imageBytes, 0, length);
         bos.flush();     
                   res.flushBuffer();
                        } else
                        if(imageType.equals("large")) {
                             resize(bis,bos,maxSizeImageWidth);
                             bos.flush();
                             res.flushBuffer();
                        } else
                        if(imageType.equals("thumb")) {
                             resize(bis,bos,maxSizeThumbWidth);
                             bos.flush();
                             res.flushBuffer();                         
                        }//if
                        //close streams
                        bis.close();
                        bos.close();
                   }//try
                   catch(Exception e) {}
              }//end          
         public void resize(BufferedInputStream bis, BufferedOutputStream bos, int maxImageWidth) {
              try {                            
              BufferedImage bufimg = ImageIO.read(bis);                                         
              //size of image
              int img_width = bufimg.getWidth();
              int img_height = bufimg.getHeight();               
              double scale = (double)maxImageWidth/(double)img_width;                    
              Image sized = getScaledInstanceAWT(bufimg, scale, Image.SCALE_SMOOTH);
              //convert image to BufferedImage
              BufferedImage resized = toBufferedImage(sized, BufferedImage.TYPE_INT_RGB);                                                                                
                        ImageIO.write(resized,"jpeg",bos);                                                                           
         }//try
         catch(Exception e){}
    }//end
    Edited by: webnotick on Apr 13, 2010 12:24 PM
    --added a method to the code snippet --                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Error while Image loading from database

    I'am using generic handler for loading Image from data bases. Its work fine when when I hardcode the ImageID in QureyString when call Handler. But it's giving errors of different type when I dynamically pass value to qurey string(from datatable).
    "There is already an open DataReader associated with this Command which must be closed first." 
    OR
    "There is already an open DataReader associated with this Command which must be closed first."
    here is a code of Handler
    public void ProcessRequest(HttpContext context)
    Int64 id = Convert.ToInt64(HttpContext.Current.Request.QueryString["adid"]);
    // dt = obj_dalayer.GetRecpDetailsByID(id);
    dt=GetRecpDetailsByID(id);
    if (dt.Rows.Count > 0)
    //context.Response.ContentType = "image/jpeg";
    context.Response.BinaryWrite((byte[])dt.Rows[0][2]);
    public DataTable GetRecpDetailsByID(Int64 reid)
    try
    obj_DB.Open();
    obj_sqlcmd = new SqlCommand("GetRecpDetailsByID", obj_DB.GetDBConnection());
    obj_sqlcmd.CommandType = CommandType.StoredProcedure;
    obj_sqlcmd.Parameters.Add(new SqlParameter("@rid", reid));
    obj_sqlda = new SqlDataAdapter();
    obj_dt = new DataTable();
    obj_sqlda.SelectCommand = obj_sqlcmd;
    obj_sqlda.Fill(obj_dt);
    return obj_dt;
    finally
    obj_DB.Close();
    And here is a HTML and ServerSide code on ASPX page of call handler.
    <img id="img2" alt="Image" runat="server" src='<%#"~/ImageReqHandler.ashx?adid="+Eval("ReID")%>' width="179" height="148" /
    I'm using Eval("ReID") to get ID of Image from datatable.

    Ayez,
    This is the VB forum, try it in the C# form.
    http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral
    However, there they will probably tell you that although your problem is C#, it is ASP.Net some programmers become scared if it is Web you know.
    Success
    Cor

  • Image Retrevial From Database throws error

    Can anyone point out what i'm doing wrong with the code below please..
    It all works perfectly and returns the image. The probelm is that it causes
    java.lang.IllegalStateException: getOutputStream() has already been called for this response
    to be thrown in the site's logfile.
    It all works perfectly by causes the log file to fill up as visitors access the image.
    <%@ page import="java.io.*" %>
    <%@ page import="java.sql.Statement" %>
    <%@ page import="java.sql.Connection" %>
    <%@ page import="java.sql.ResultSet" %>
    <%@ page import="java.sql.DriverManager" %>
    <%
    Connection connectiongalleryimage = null;
    Statement statementgalleryimage = null;
    InputStream sImage = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    connectiongalleryimage = DriverManager.getConnection("jdbc:mysql://cluster_01:3306/site_db", "xxxxxx", "xxxxxxx");
    statementgalleryimage = connectiongalleryimage.createStatement();
    ResultSet rs = statementgalleryimage.executeQuery("select main_image from galleryobj where galobj_id=5 and rec_status='ACTIVE'");
    rs.first();
    byte[] bytearray = new byte[4096];
    int size=0;
    sImage = rs.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    OutputStream outputStream = response.getOutputStream();
    while((size=sImage.read(bytearray))!=-1) {outputStream.write(bytearray,0,size);}
    } catch (Exception e) {
    out.println("<!-- Error getting requested image: "+e+"-->");
    } finally {
    response.flushBuffer();
    sImage.close();
    statementgalleryimage.close();
    connectiongalleryimage.close();
    %>

    Google has lot of examples: http://www.google.com/search?q=imageservlet+code+example
    At least here is one: http://balusc.blogspot.com/2007/04/imageservlet.html

  • Image retrieval from database

    How can i display an image item (BLOB) of oracle database on an HTML page using JAVA servlets?

    Put an IMG tag into the HTML page.
    Let the URL be your servlet. Do not forget to set the content type.

  • Image Loaded From Database not Visible in JLabel

    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    public class consqlimage
         public consqlimage()
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   Connection con = DriverManager.getConnection("jdbc:odbc:dsn","sa","manshu");
                   Statement stat = con.createStatement();
                   ResultSet rs = stat.executeQuery("Select pic from t_image");
                   byte b[];
                   b = new byte[1000];
                   while(rs.next())
                        b= rs.getBytes("pic");
                   for(int a=0;a!=b.length;a++)
                        System.out.println(b[a]);
                   JFrame f = new JFrame();
                   ImageIcon i1 = new ImageIcon(b+"jpeg");
                   JLabel l1=new JLabel("january",i1,SwingConstants.LEFT);
                   f.getContentPane().add(l1);
                   f.getContentPane().setLayout(new FlowLayout(FlowLayout.LEFT));
                   f.setSize(500,500);
                   f.setVisible(true);
                   con.close();
              catch(Exception e)
                   System.out.println(e);
         public static void main(String args[])
              new consqlimage();
    }

    Any reason why you are adding the "jpeg" to the end of the byte array?
    You should only have to pass the byte array to the ImageIcon constructor.

  • Displaying image from database in report

    I need to include a picture (company logo) in numerous reports. This logo will be stored in an MS SQL Image field in a table (this bit I have already sorted out).
    What I'm wondering is, what is the best way to retrieve this image from the database? Do I just include it in the view the report runs off? I'm hesitant to do this, as the view may return back hundreds of records, which means (I think) it will be sending the image along with it hundreds in time.
    In short:
    1) What is the best way to pass an image to a report.
    2) If I include the Image field in a view which returns back hundreds of line, will the image be returned also hundreds of time, causing network congestion/performance issues?
    3) If so (2), is there a way of sending the image only once, no matter how many rows are in the returned view?
    Thanks.

    Hi Shanon,
    We can display the image by making it a local copy on your machine.
    If it is possible to  get the image saved on local copy.
    If we place the image in detail section then it would return one record.
    As the image is from Database, so it would hit the database very time when you refresh the report and place it in Report Header or report fotter.
    So, place your logo as an OLE object in report and would reduce processing time.
    Regards,
    Naveen.

  • I get error message each time I try to retrieve image (BLOB) from Oracle

    Can anyone help me?
    I am working with Servlet and JDBC with Oracle database. I can insert an image (GIF file) in a Oracle
    table in a BLOB field. But everytime I want to retrieve it
    I got an error "AbstractMethodError". My retrieve program (only the main part) is as below:
    String dbURL="jdbc:oracle:thin:@200.200.100.2:1521:tvm";
    String db_username="PROJ1"; String db_password="PROJ1";
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver");
    }catch(ClassNotFoundException e1){ }
    try{
    Connection c=DriverManager.getConnection(dbURL,db_username,db_password);
    // Retrieving image file from database
    RandomAccessFile raf=new RandomAccessFile("//Davison/jakarta/webapps/examples/images/a10.gif","rw");
    PreparedStatement pstmt2=c.prepareStatement("Select fname,photo From testtable1 where fname=?");
    pstmt2.setString(1,"rere100");
    ResultSet rs=pstmt2.executeQuery();
    while(rs.next()){
    Blob blobImage=rs.getBlob("photo");
    int length=(int)blobImage.length();
    byte[] blobArray=blobImage.getBytes1,length);
    raf.write(blobArray);
    raf.close();
    Please help me soon, my email is: [email protected]
    Bye , Rea

    Probably a bit late, but I just got the same problem.
    Oracle seems to instantiate a class which is not fully defined-
    oracle.sql.BLOB. This class has abstract methods, and is therefore
    an abstract class.
    In short, Oracle are stupid fools. How they managed to instantiate
    an abstract class in the first place should be of concern to the
    Java gurus, however. Native code in the OCI driver perhaps?
    If you still need help, you could try uning the Thin driver- or
    a database with a JDBC driver which actually meets the spec. There
    are third party Oracle drivers which might fit the bill- they
    usually cost money, however.

Maybe you are looking for