How Can i Store photo (image) in column of table

Dear Experts,
I need to store a employee photo in column so how can i do tha same.

This assumes that the images in question currently reside on the database server. If you want to upload images into the database from a client machine, you will need an extra step where you move the files to the appropriate directory or directories on the server. This example will store the images in a BLOB column, rather than a much more flexible interMedia ORDImage column. A BLOB column is fine if you only want to store and retrieve the image, but interMedia gives you significantly more flexibility to manipulate the image, extract metadata, etc.
Create the directory
First, you will want to tell Oracle where it can find the images you want to insert into the database. The easiest way to do this is to create a directory object. In this case, I will be loading images from 'c:\temp\img\'.
CREATE DIRECTORY images AS 'c:\temp\img\'
If you don't have the CREATE DIRECTORY privilege, you will need to have someone else, like your DBA, create the directory and grant you READ access to it.
GRANT READ ON DIRECTORY images TO scott;
Create the Table to Hold the Images
CREATE TABLE images (
image_name VARCHAR2( 100 ),
mime_type VARCHAR2( 100 ),
content BLOB
Create a Stored Procedure to Load the Image
CREATE OR REPLACE PROCEDURE load_image( file_name VARCHAR2 )
AS
file_lob BFILE;
binary_lob BLOB;
mime_type images.mime_type%type;
extension_pos NUMBER;
BEGIN
-- Use the extension of the file name to determing the MIME-type
-- The MIME-type for a .JPG file will be image/jpg
extension_pos := INSTR( file_name, '.' );
mime_type := 'image/' || SUBSTR( file_name,
extension_pos + 1,
LENGTH( file_name ) );
-- Insert a new row into the images table. Get the LOB locator
-- for the newly inserted row-- we will be using that to insert
-- the content from the file.
INSERT INTO IMAGES( image_name, mime_type, content )
VALUES( file_name, mime_type, empty_blob() )
RETURNING content INTO binary_lob;
-- Open up the file in the IMAGES directory named file_name,
-- load that file into the newly created LOB locator, and
-- close the file
file_lob := BFILENAME( 'IMAGES', file_name );
dbms_lob.fileOpen ( file_lob, dbms_lob.file_readOnly );
dbms_lob.loadFromFile( binary_lob,
file_lob,
dbms_lob.getLength( file_lob ) );
dbms_lob.fileClose ( file_lob );
END;
Load the Image
scott@jcave > exec load_image( 'sample.jpg' );
PL/SQL procedure successfully completed.
scott@jcave > column image_name format a30;
scott@jcave > column mime_type format a15;
scott@jcave > column length format 999999;
scott@jcave >
1 SELECT image_name, mime_type,dbms_lob.getLength( content ) length
2 FROM images;
no rows selected
Elapsed: 00:00:00.00
scott@jcave > /
IMAGE_NAME MIME_TYPE LENGTH
sample.jpg image/jpg 9894
Regards
Lakmal

Similar Messages

  • How can we store an image in the file the image is int he form of bytes

    hi
    How can we write an image to a file and save it to hardisk the i mage is in the form of bytes please if any body knows please send the code for it
    Thanks for u reply

    can u send the code for me
    my image is in the form of bytes its size is=78K;
    now i want to store image in database using BLOB type i blob datatype size is25k;
    how i should store
    Help me if know anything about this
    Thanks In Advance

  • How to store photo images in a database table?

    Hello Y'all,
    How do I store about 695 signs inventory photo images from a PDF file to an Oracle database table? We are using Oracle 10.2.0.2. What data type should I use for these images? How about the table space? What table space should I allocate to ensure there is no space issue?
    Thanks in advance for any/all the help.

    Here you go..
    Assuming you have a table
    test_blob (col1 BLOB);
    Create an oracle directory or use an existing one to place the image on the oracle server.
    create or replace directory tmp_blob as '/tmp';This tmp location should exist on your server where oracle is installed.
    also ftp the image file (say image1.bmp) to this location
    declare
    l_blob BLOB;
    l_bfle BFILE;
    l_re BOOLEAN := FALSE;
    Begin
    DBMS_LOB.createtemporary(l_blob, TRUE);
    insert into test_blob(col1) values (EMPTY_BLOB())
    returning col1 into l_blob;
    --return image into l_blob;
    l_bfile := BFILENAME('TMP_BLOB','image1.bmp');
    --check if file exists
    l_ret := DBMS_LOB.fileexists (l_bfile) = 1;
    if (l_ret)
    then
    DBMS_LOB.fileopen(l_bfile);
    DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
    commit;
    else
    DBMS_OUTPUT.put_line('File not present');
    end if;
    end;
    / not tested this exact one.. check for the syntax errors if any.. this should work

  • How can I store photos already taken in iCloud?

    Can you only store photos taken after you set a photo stream? Or can I store all of my pictures?

    You would only need extra iCloud space if you need the space for large backups, or backups of multiple iOS devices, or if you save lots of iCloud email with large attachments, or store lots of iWork documents, etc.
    You can store your photos using a different cloud service such as Dropbox, or any of the numerous photo hosting services such as Flikr, Picassa, Smugmug, etc.  Music purchased from sources other than the iTunes store has to be kept in your iTunes library on your computer if you want to be able to access it on your iOS devices.

  • How can I store photos on an external hard drive and still manage w IPhoto?

    The hard drive on my MacBook is almost full and I want to move my photos to an external hard drive.  Can I do this and still manage and organize the photos using I Photo?   I can export the photos, but when I do I lose the organization (Events, Albums, etc.) that are in I Photo.   With my new DSLR camera the photos (JPEGS) are really big and I am quickly running out of storage on the MacBook.  Thanks in advance for you help.
    Jim in Seattle

    Moving the iPhoto library is safe and simple - quit iPhoto and drag the iPhoto library intact as a single entity to the external drive - depress the option key and launch iPhoto using the "select library" option to point to the new location on the external drive - fully test it and then trash the old library on the internal drive (test one more time prior to emptying the trash)
    And be sure that the External drive is formatted Mac OS extended (journaled) (iPhoto does not work with drives with other formats) and that it is always available prior to launching iPhoto
    And backup soon and often - having your iPhoto library on an external drive is not a backup and if you are using Time Machine you need to check and be sure that TM is backing up your external drive
    LN

  • How can I Export the Image file into Oracle Table

    <tt>
    Hi Folks,
    I have one requirement with me, but i can't able to find the solution for that, so kindly any one give a suggestion for my requirement.
    Let me explain my requirement in detail.. I have one table called SIGN this table contain customer signature image as well as the image of the customer. The SIGN have the following columns
    </tt>
       CREATE TABLE SIGN
      ID                    VARCHAR2(50 BYTE)            NOT NULL,   "This column containing the Customer ID"
      IMAGE_C_FLAG          CHAR(1 BYTE)                 NOT NULL,   "This column containing the whether ID belong to Signature or Photo"
      IMAGE                 BLOB,                        NOT NULL,  "This Column Containing the Image "
      ENTERED_C_BY          VARCHAR2(10 BYTE)
    The SIGN having the following values
    ID                                                 C I IMAGE
    23900033                                           Y S  (BLOB)
    23900034                                           Y S  (BLOB)
    23900035                                           Y S  (BLOB)
    23900036                                           Y S  (BLOB)
    23900042                                           Y S  (BLOB)<tt>
    I want to export those Image from Table into my machine local folder with the extension of .JPEG(C:\IMAGE)
    How can i do that in oracle... please kindly any one give the solution for this..
    This is my Oracle server version
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
    PL/SQL Release 10.1.0.2.0 - Production
    CORE 10.1.0.2.0 Production
    TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
    NLSRTL Version 10.1.0.2.0 - Production
    Thanks in Advance
    Arun
    </tt>

    Hi Arun,
    Please view the below links. Hope these helps you as there are also of similar discussion.
    Insert Picture (image) using oracle forms
    Insert Picture (image) using oracle forms
    insert image to atable in forms builder
    Re: insert image to atable in forms builder
    Thanks,
    Balaji K.

  • How can i store a picture file in a table using sql

    can anyone help me
    to store a pic file in a table using sql

    You can find an example in this link
    http://www.orafaq.com/forum/t/38347/0/

  • How can i store the following pattern in the table automatically.

    hey hi fellas
    i need a table which can automatically store elements in following pattern:
    IN00001
    IN00002
    IN00003
    IN99999
    thanks in advance

    PL/SQL

  • How can I manually attach images from my photo booth (imported into iPhoto) to emails? Auto function, in photo booth has my photos lying sideways?

    How can I manually attach images from my photo booth to iCloud emails?
    They are imported as 'events' into my iphoto library.
    Auto function, in photo booth has my photos lying sideways when placed in 'mail' emails?

    There are many, many ways to access your files in iPhoto:   You can use any Open / Attach / Browse dialogue. On the left there's a Media heading, your pics can be accessed there. Command-Click for selecting multiple pics.
    (Note the above illustration is not a Finder Window. It's the dialogue you get when you go File -> Open)
    You can access the Library from the New Message Window in Mail:
    There's a similar option in Outlook and many, many other apps.  If you use Apple's Mail, Entourage, AOL or Eudora you can email from within iPhoto.
    If you use a Cocoa-based Browser such as Safari, you can drag the pics from the iPhoto Window to the Attach window in the browser.
    If you want to access the files with iPhoto not running:
    For users of 10.6 and later:  You can download a free Services component from MacOSXAutomation  which will give you access to the iPhoto Library from your Services Menu.
    Using the Services Preference Pane you can even create a keyboard shortcut for it.
    For Users of 10.4 and 10.5 Create a Media Browser using Automator (takes about 10 seconds) or use this free utility Karelia iMedia Browser
    Other options include:
    Drag and Drop: Drag a photo from the iPhoto Window to the desktop, there iPhoto will make a full-sized copy of the pic.
    File -> Export: Select the files in the iPhoto Window and go File -> Export. The dialogue will give you various options, including altering the format, naming the files and changing the size. Again, producing a copy.
    Show File:  a. On iPhoto 09 and earlier:  Right- (or Control-) Click on a pic and in the resulting dialogue choose 'Show File'. A Finder window will pop open with the file already selected.    3.b.
    b: On iPhoto 11 and later: Select one of the affected photos in the iPhoto Window and go File -> Reveal in Finder -> Original. A Finder window will pop open with the file already selected.

  • Photos in album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Photos in iPhoto album are only a hash-marked outline the image only shows when scrolling how can I see the image and open the photo?

    Make a temporary, backup copy (if you don't already have a backup copy) of the library and apply the two fixes below in order as needed:
    Fix #1
    Launch iPhoto with the Command+Option keys held down and rebuild the library.
    Select the options identified in the screenshot. 
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    Download iPhoto Library Manager and launch.
    Click on the Add Library button, navigate to your Home/Pictures folder and select your iPhoto Library folder.
    Now that the library is listed in the left hand pane of iPLM, click on your library and go to the File ➙ Rebuild Library menu option
    In the next  window name the new library and select the location you want it to be placed.
    Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • How to store photo images and thumbimpressions in oracle 10g database

    Hi all
    I have an web application running in Oracle 10g rel 1 database server in RHEL3. It has application server with forms and j2ee component as middle tier. I need to store centrally photo images and thumb impressions and use it in our application without any overhead on retrieval and performance of web application. what will be optimized method of storage of photo and thumb impressions. Awaiting your valuable suggestions.
    Regards
    Vijay Kumar

    Hi Vijay,
    How to store photo images and thumbimpressions in oracle 10g database I have working code here for storing photos in Oracle tables that you may find useful:
    http://www.dba-oracle.com/t_storing_insert_photo_pictures_tables.htm
    Hope this helps . . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference"
    http://www.rampant-books.com/book_2005_1_awr_proactive_tuning.htm

  • HT201386 how can I find the Image number of a particular photo in the Photos app included with iPad Air?

    how can I find the Image number of a particular photo in the Photos app included with iPad Air?

    Hello yamacutta,
    Thanks for using Apple Support Communities.
    The Photos app will not show you the actual file name of the photo.  However when you go through the image import process on your computer, you should be able to see both the thumbnail of the photo, as well as the filename of the image.
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    Take care,
    Alex H.

  • How can I control the image size when I export form iphoto, the choice is too limited, I need to send a photo under 3 MB but if I choose high quaulity it is only 1.1 and i need to keep the best quaulity I can. Thanks for help.

    How can I control the image size when I export form iphoto, the choice is too limited, I need to send a photo under 3 MB but if I choose high quaulity it is only 1.1 and i need to keep the best quaulity I can. Thanks for help.

    Any image can only be as large as the Original. With a program like Photoshop you can UpRes an image and get it to a bigger size, larger files size as well, but the actual quality of the image will be degraded, depending on the UpRes system and the original quality of the image.
    iPhoto is not the program to be doing that in and I don't think it even has that option.
    So I suspect the image you are trying to send isn't much bigger than what you are getting. You can also try Exporting it from iPhoto to yopur desktop and see what size you end up with. If it is still that 209KB +/- file size then that is the size of the original image.

  • I've transferred photos to my ipod classic from my laptop. But how can I transfer JPEG images to ipod?

    I've transferred photos to my ipod classic from my laptop. But how can I transfer JPEG images to ipod?

    Hello, Blondet787. 
    JPEG photos are compatible with your device.  As long as these images are in the same folder as your pictures, then they should sync.  Below, I have included a couple articles that show you how to sync this data to your iPod.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    The article below is a little more detailed and designed more as a storage solution for media on your iPod Classic. 
    Putting iPod into Disk Mode
    http://support.apple.com/kb/ht1363
    Cheers,
    Jason H.

  • HELP! moved "all images" to trash by mistake. They are still there but I can't undo. How can i return photos to iphoto? Thx!

    HELP! moved "all images" to trash by mistake. They are still there but I can't undo. How can i return photos to iphoto? Thx!

    Thanks but I have no "Put Back" option when right-clicking. When I attempt to open a photo in iPhoto I receive a white exclamation point on a black background. I have restarted my PC since first encountering this problem but have not emptied trash though i appear to be out of memory. Also, iphoto library shows size as 17GB however, each photo shows 0KB. When i attempt to open a photo i receive message "Item <photo filename> is used by Mac OS X and cannot be opened." I can see the images when scrolling in iPhoto but they disappear when the screen is still. THANKS!

Maybe you are looking for

  • I am looking for an example of how to use the Rendezvous synchronization object.

    I can't seem to find an example that uses the TestStand Synchronization Step Types. I am specifically interested in the Rendezvous type. I am have programmed quite a few VC++ applications that use semaphores, so I am familiar with the overall idea of

  • Issue while loading master data from BI7 to BPC

    Dear Experts, I'm trying to load master data from BI7 to BPC NW using scenario 2 mentioned in the below document. https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00380440-010b-2c10-70a1-e0b431255827 My requirement is need to load

  • When I downloaded Pages my Apple Works 6 now doesn't open.

    When I downloaded Pages my Apple Works 6 now doesn't open.

  • Supported Video Cards - I Know...Not Again!!!

    Hello, I had to remove an extension awhile back from the Extensions folder in <<System - Library - Extensions>> and i noticed a few Driver.bundle's. What caught my eye were the videocard driver bundles. They are: Apple Intel GMA 950GLDriver.bundle Ap

  • Adobe Plug in

    Hi folks, I am new on this forum and would like to ask some help from any expert. I paid this software Acrobat Reader 8 before and I called customer support and told me I would have to pay for support with this problem that I am having. So, I tried t