Saving image as file or in database

What is the best practice for saving user uploaded picture? Should that image be saved in database or in some directory.

And it depends on your configuration. You might decide to put the images in a folder, which is a perfectly good decision. Until you decide your server is going to become a pair of servers behind a load balancer. Now both of those servers need access to the folder where you're putting the images, and you have a technical problem. Not one which can't be solved, but you do have to recognize that it is in fact a problem at the time you decide you're moving to a distributed server architecture.

Similar Messages

  • About saving images and file formats

    This question was posted in response to the following article: http://help.adobe.com/en_US/photoshopelements/using/WS287f927bd30d4b1f89cffc612e28adab65-7 fd9.html

    . I was able to do, what I was unable to do in last 2 days.
    I just wanted to point that, with iPhot 11, which I am using,  iPhoto menu ->Preferences->General-> ,Edit Photos pulldown menu did not appear. This step #2, where selection of  Photoshop Element had to to be done with use of "Advanced" menu.
    Thank you for the help.
    Aziz

  • Saving image file as binary into database + pulling it out + displaying

    Hi guys, this is exactly I have to do, and have no ideal how to do.
    It will be greatly appreciated if you can offer help on this.
    I don't have a problem putting it into and pulling it out fo the database, it is really the jpg-> binary, and binary->display part that I need help on.
    Btw, I am currently using "draw Flatten PixMap.VI" to display a picture in labview, from a jpg file. Can I still use this VI to achieve what I intend to do?

    Have you tried this:
    Saving a binary file to a database with the Database Connectivity Toolset
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • Saving images in a mysql db?

    Hi you all,
    I have a question.
    I'm working on a school project. And I was wondering if it is possible to save an image to a MySQL db with java.
    I would like to save an specified image to the database, but I'm also wondering is I could display the image from the database again (I prefere that there is no temp file created).
    (I have done this before with PHP)
    Does anyone has ideas or sample codes for me?
    Please hurry, I have only short time to finish the project.
    With Kind Regards,
    Franck Nijhof
    (ps sorry my bad english)

    I know that file in system is better. But in out project we must be saving a binary file in the database. A image is not that big and can be used usefull.
    So I like to do an image instead of an big program.
    (BTW I need it anyway, we need to build the program multiuser with network, this mean one is loading the image and everybody need to get it if they want to)
    Hopefully some can help!
    With kind regards,
    Franck Nijhof

  • Saving image in ms sql database.

    Hi all, i have a problem saving image in the database.i used
    request.getParameter("imagename"), to get the content of the textfield in the html file but the problem is that it omits the filepath and gives me just the image name and that gives me an error.. Pls help me

    Your actual problem is less or more web browser related. The right way is that the browser should only send the filename, but a certain widely used browser developed by a team in Redmond would send the full file path as it is at the client side, which is completely wrong.
    The bigger picture what you're trying to achieve, uploading a file from the client to the server, shouldn't be done that way, simply because this isn't going to work at all if the client runs at a completely different machine on the other side of the network than where the server runs. You need to send the actual file contents to the server. Just set the form's enctype to multipart/form-data and parse the body of the request to get the actual file contents. To ease the work I recommend you to use Apache Commons FileUpload API for parsing the multipart/form-data request. Go to their homepage and check out the 'User guide' and 'Frequently Asked Questions' how to use it and for some tricks.

  • Data type for Saving Image in SQL database

    Hi,
        Which is the best way for saving images in the database? Filestream or Varbinary(max)?. Will the Varbinary max comsume much space or it will only take the actual size of the data?

    I've used FILETABLE for storing images in SQL 2012
    You can configure it to have transact and non transact access if you want
    see
    http://visakhm.blogspot.in/2012/07/working-with-filetables-in-sql-2012.html
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to insert an image file in Oracle database

    hi
    can you please tell me how to insert an image file into oracle database????
    suppose there is one image file in c:\pictures\rose.jpg. how to insert that file into database? theoretically i know that will be BFILE type but i dont know how to insert that.
    will be waiting for your reply........
    thanks & regards,
    Priyatosh

    Hello,
    The easiest way to load a blob is to use SQL loader.
    This example comes from the utilities guide:
    LOAD DATA
    INFILE 'sample.dat'
    INTO TABLE person_table
    FIELDS TERMINATED BY ','
    (name CHAR(20),
    1 ext_fname FILLER CHAR(40),
    2 "RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
    Datafile (sample.dat)
    Johny Quest,jqresume.txt,
    Speed Racer,'/private/sracer/srresume.txt',
    Secondary Datafile (jqresume.txt)
    Johny Quest
    500 Oracle Parkway
    Secondary Datafile (srresume.txt)
    Loading LOBs
    10-18 Oracle Database Utilities
    Speed Racer
    400 Oracle Parkway
    regards,
    Ivo

  • How to insert a image file into oracle database

    hi all
    can anyone guide me how to insert a image file into oracle database now
    i have created table using
    create table imagestore(image blob);
    but when inserting i totally lost don't know what to do how to write query to insert image file

    Hi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
    Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
    out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
    out.println("   <input type='submit' name='submit' value='Submit' class='smalltext'>");
    out.println("</form>"); Import this once you have the jar file:
    import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
    private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
            boolean result = true;
            String fileName = null;
            byte fileData[] = null;
            String fileUploadError = null;
            String imageType = "";
            String error = "";
            DiskFileUpload fb = new DiskFileUpload();
            List fileItems = fb.parseRequest(request);
            Iterator it = fileItems.iterator();
            while(it.hasNext()){
                FileItem fileItem = (FileItem)it.next();
                if (!fileItem.isFormField()) {
                    fileName = fileItem.getName();
                    fileData = fileItem.get();
                    // Get the imageType from the filename extension
                    if (fileName != null) {
                        int dotPos = fileName.indexOf('.');
                        if (dotPos >= 0 && dotPos != fileName.length()-1) {
                            imageType = fileName.substring(dotPos+1).toLowerCase();
                            if (imageType.equals("jpg")) {
                                imageType = "jpeg";
            String filePath = request.getParameter("FILE_PATH");
            session.setAttribute("filePath", filePath);
            session.setAttribute("fileData", fileData);
            session.setAttribute("fileName", fileName);
            session.setAttribute("imageType", imageType);
            return result;  
         } And now finally the method to actually write the file to the database:
    private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
            //If the previous code found a file that can be uploaded then
            //save it into the database via a pstmt
            String sql = "";
            UtilDBquery udbq = getUser(request).connectToDatabase();
            Connection con = null;
            int signatureID = 0;
            PreparedStatement pstmt = null;
            try {
                udbq.setUsePreparedStatements(true);
                con = udbq.getPooledConnection();
                con.setAutoCommit(false);
                if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
                    sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
                    pstmt = con.prepareStatement(sql);
                    ResultSet rs = pstmt.executeQuery();
                    while(rs.next()) {
                       signatureID = rs.getInt(1);
                    if (fileName != null && imageType != null) {
                        sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setInt(1, signatureID);
                        pstmt.setBinaryStream(2, is2, (int)(fileData.length));
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
                if(mode.equals("U") && signatureIDIn != 0) {
                    signatureID = signatureIDIn.intValue();
                    if (fileName != null && imageType != null) {
                        sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setBinaryStream(1, is2, (int)(fileData.length));
                        pstmt.setInt(2, signatureID);
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
            } catch (Exception e) {
                con = null;
                throw new Exception(e.toString());
            return signatureID;
       }

  • Why do the file extensions (.jpg .gif .png) no longer appear when I click on a previously saved image to use that image's file name (particularly important when saving a series of images using the same root name)?

    I save a lot of images using firefox, often times from a large batch or series of images. It used to be that I would click on a previously saved image and the entire file name including the file extension (i.e. image_example.jpg) would appear in the "save as" line. Now when I click on a previously saved file, the file name appears without the file extension (i.e. image_example). Which means I have to manually type .jpg every time. For a large collection of images that I am hoping to use the same root file name and then add chronological numbers at the end, this has become incredibly frustrating, especially as it is a previously unnecessary task.
    I am using a new Macbook Pro and maybe there's something Apple related to this...? It did not happen on my old PowerBook G4. I have file extensions turned on in System Preferences.
    It should be noted that I have searched high and low and have even gone into the Apple Genius Bar where they were just confused as I was and of course ended by urging me to use Safari (shocker!) as it has all kinds of new extensions and bells and whistles. I seriously feel alone on an island with this dumb, hard to google problem. Thanks so much for any help anyone out there might have.
    I mean: is this as simple as changing a setting in about:config?
    Your assistance is greatly appreciated.

    Thanks for your response Mylenium, however like I mentioned multiple times, I did change all of my trackpad/scrolling settings in system preferences.  And if I wanted to use a normal mouse (or a tablet), I would've gotten an iMac instead of a MacBook Pro.  I travel often and work all over the place, not always with access to a decently sized workspace that would be required for using a mouse or tablet.

  • Black background of saved image file.

    Hello All,
    My code is set up to create an image then save the image into a file in JPEG format. Everything works well except the background of the saved image is balck. How can I get a white background on the saved file?
    I have posted my code below. I have allocated 10 duke dollars for the person solves who this? Thank You!!!!
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    import com.sun.image.codec.jpeg.*;
    import java.io.*;
    import java.awt.image.BufferedImage;
    public class Test2 extends JApplet {
    public void init() {
    //Initialize drawing colors
    setBackground(Color.white);
    setForeground(Color.black);
    public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Dimension d = getSize();
    int gridWidth = d.width / 6;
    int gridHeight = d.height / 2;
    // fill Rectangle2D.Double (red)
    g2.setPaint(Color.red);
    g2.fill(new Rectangle2D.Double(100, 100, 100, 100));
    g2.setPaint(Color.black);
    g2.drawString("My Rectangle", 125, 85);
    public static void main(String s[]) {
    JFrame f = new JFrame("Test2");
    f.addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {System.exit(0);}
    JApplet applet = new Test2();
    f.getContentPane().add("Center", applet);
    applet.init();
    f.pack();
    f.setSize(new Dimension(400,300));
    f.show();
    saveAsJPEG(applet, 1.0F, "myJPEG.jpg");
         public static void saveAsJPEG(Component component, float quality, String filename)     {
              try          {
                   Dimension d = component.getSize();
                   BufferedImage bimage = new BufferedImage(d.width, d.height, BufferedImage.TYPE_INT_RGB);
                   component.paint(bimage.createGraphics());
                   Graphics2D g = (Graphics2D)bimage.getGraphics();
                   g.setPaint(Color.white);
                   if(!filename.endsWith(".jpg"))
                        filename += ".jpg";
                   OutputStream out = new FileOutputStream(filename);
                   JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
                   // Create JPEG encoder
                   JPEGEncodeParam jpegParams = encoder.getDefaultJPEGEncodeParam(bimage);
                   jpegParams.setQuality(quality, false);
                   // Set quality to (quality*100)% for JPEG
                   encoder.setJPEGEncodeParam(jpegParams);
                   encoder.encode(bimage);
                   // Encode image to JPEG and send to browser
                   out.close();
              catch (Exception e)          {
                   System.out.println(e);
    }

    I've added 2 lines to your paint, it works now.
    public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Dimension d = getSize();
    int gridWidth = d.width / 6;
    int gridHeight = d.height / 2;
    // make a white background
    g2.setPaint(Color.white);
    g2.fill(new Rectangle2D.Double(0, 0, d.width, d.height));
    // fill Rectangle2D.Double (red)
    g2.setPaint(Color.red);
    g2.fill(new Rectangle2D.Double(100, 100, 100, 100));
    g2.setPaint(Color.black);
    g2.drawString("My Rectangle", 125, 85);
    }

  • Storing image files (.gif)  into database from sql plus

    dear all
    I have to store image files into a table with BLOB attribute.
    What will be the insert command to insert a .gif file into the database.
    thanks.

    You can use DBMS_LOB.LoadFromFile, I assume you would load these as a BLOB.
    The documentation can be found on technet at
    urlhttp://technet.oracle.com/docs/products/oracle9i/doc_library/901_doc/appdev.901/a89852/dbms_20b.htm#1009007
    [\url]
    An alternative would be to use java to read the file from the file system, and serve it up as a CLOB or BLOB, and INSERT it into the database from there.
    Good Luck,
    Eric Kamradt

  • How I can store Image file in a database

    Can any one how i can stored image file in a database and then by using same database how i can show in HTML page...(in a browser)

    This is not something that can be answered easily. There is quite alot of code involved....
    To get started I suggest you read up on the built-in package 'DBMS_LOB' from Oracle . Most of what you need you should find there.
    regards Dave.

  • Saving image files - TIFF file extension wasn't acceptable

    Hello! 
    When I save an image on my iMac the default situation appears to be that the file has a TIFF file extension.
    Please review the post I recently made here:     http://www.wilderssecurity.com/threads/why-are-tagged-image-file-format-tiff-fil es-unacceptable-here.370185/#post-2426799
    I should be grateful if someone can shed some light on my conundrum/confusion.  It should be self-explanatory!
    Any help will be gratefully received!
    David B.

    Hello again   So sorry for the delay in replying to folk for the helpful responses.
    If one re-visits my original link one can view a response - in essence, look here:-   https://answers.yahoo.com/question/index?qid=20090125135844AAwqjkB
    After some reflection, I decided to do nothing at all!  However, today I looked under 'Grab' preferences and found that there is no way to change the image format of a screen capture. BUT ..... I then looked under 'Grab Help' and found this ....
    Save screenshots:  After taking a screenshot, choose File > Save, enter a name, add a tag (optional), then choose a folder. Screenshots are saved as TIFF files.
    Convert a screenshot to another format:  Open your screenshot in the Preview app. Choose File > Export, click the Format pop-up menu and choose a format, then click Save. For more information, see Convert graphics file types.
    So I now know what to do if/when I need to switch to another format! 
    Many thanks to rkaufmann87  and Frank Miller2 - your guidance is much appreciated,
    David B.

  • I have taken pictures of items that are linked to a database that I am building.  How can I bypass importing into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    I have taken pictures with both my Sony camera and my iPhone of items that are linked to a database that I am building, as well as my website.  How can I bypass importing the images into iPhoto and simply downloading the images as "files" not "photos" so I can access them with my database?  thanx.

    If your Sony has a removable memory card you can use a card reader to copy the image files from to a folder on your Desktop and then move them anywhere you'd like.
    Since the iPhone doesn't have a removable memory card you can try using Image Capture to see if you can manually upload the files to a folder on the Desktop. 
    If you have to import the photos, which are image files, into iPhoto you can then export them out of iPhoto to the Desktop and go from there to your database.  Just because they are in iPhoto doesn't prevent you from using them elsewhere.
    OT

  • When saving image i want that firefox auto change the file name if same name exists like google chrome etc. if there is any option pl let me know.

    when saving image i want that firefox auto change the file name if same name exists, like google chrome does this. if there is any option pl let me know.

    this saves images, i just want to save single image, and wants while saving image, it auto changes the name if find similar name of file in the folder. chromium and maxthod does this

Maybe you are looking for

  • How to convert date (dd/mm/yyyy) to week no. calendar?

    hi all, I have a question about if user enters 12/12/2004(dd/mm/yyyy), which week is that? I just know week no. should from 01 to no more than 53. How to convert date to week no.? Thanks

  • How to insert data using jdeveloper 11g

    hi all.. i'm starting my first web aplication using JSF in jdeveloper 11g. I have one table in the database has two attributes(id and name). i connected to the database succrssfuly. i built adf application and created JSF page then i draged my view f

  • New conversation windows start minimized?

    Is there a way to make Skype act like a more traditional IM client, so that every time someone sends me a message, the conversation window pops up? I am using Skype in Compact Mode and I have selected the "Open a new window when I receive a new messa

  • Nano will not be recognised by my laptop anymore

    Tried resetting it. Re installed itunes. This has happened after updating itunes to latest version

  • Control indicators for controlling does not exist

    Hi, While doing g/l posting I got this error "Control indicators for controlling area----does not exist" Please help me with the solution. Regards, Jyoti