Results 1 to 4 of 4
  1. #1
    aw249 is offline Member
    Join Date
    Feb 2012
    Posts
    4
    Rep Power
    0

    Default Is it possible to load images.....

    Hey all,

    I have this problem re loading images.....i havent done any coding yet, but i was curious about something. i have a front end java gui for a phpmyadmin database which works great, on a specific jframe im able to select (via a filechooser) a file address of an image to be stored against a row (lets say it reflects a profile pic for a person in a database).

    My query is whether it is possible to select that row, get the string (get.string) of the file location and then locate on the computer the pic and then show in a jpanel. lets say......

    or would it be easier to store the image in the database......

    many thanks in advance.

    Alex

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,824
    Rep Power
    19

    Default Re: Is it possible to load images.....

    Both of those are valid ways of doing it, and both are used.
    Personally I prefer to store the stuff in the database, but do whatever you feel is easier for you.
    Note, if you're going to have lots of these then you'll have to factor in any limits the OS might have on numbers of files in a single directory.

  3. #3
    aw249 is offline Member
    Join Date
    Feb 2012
    Posts
    4
    Rep Power
    0

    Default Re: Is it possible to load images.....

    well lets say that table in the database has 16000 rows, and most of those rows need a pic assisgned, also the the program i am creating needs to be portable.

    just out of curiousity, what method would you suggest best to use for this, from what ive read, there is the bufferedimage, blob, imageicon etc.....

    thank you once again

  4. #4
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,824
    Rep Power
    19

    Default Re: Is it possible to load images.....

    The database will hold it as a Blob (or equivalent).
    16000 will fit in a single directory (FAT32 has a 65k limit I think), so long as you;re not planning on actually physically looking in the directory using your OS.

    In your Java program you'll load it as a stream which you'll pass into whatever image class you are using (Image, BufferedImage, Icon, etc). And that will be defined by what you are going to do with it. If Swing then it'll probably be an ImageIcon, so you can plonk it into buttons, labels easily I suppose. Note, Swing is not my strongpoint...:)

Similar Threads

  1. Can't load images
    By iTyGuy32 in forum New To Java
    Replies: 2
    Last Post: 07-30-2011, 04:57 AM
  2. How to Load images one by one...
    By abhay_mishra in forum AWT / Swing
    Replies: 0
    Last Post: 05-09-2011, 05:23 PM
  3. Load and Save images
    By shakeel in forum Java 2D
    Replies: 13
    Last Post: 12-29-2010, 06:38 PM
  4. Replies: 0
    Last Post: 08-13-2010, 10:52 AM
  5. Cannot load images at the SliderDemo
    By HelloRick in forum New To Java
    Replies: 0
    Last Post: 10-07-2009, 09:58 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •