SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem storing raw exif data in database

    Hi,

    i've created a mediumtext field in my table to store photo exif info. The problem now is that whenever the raw exif data are insert into the field, the data got truncated. I even tried changing my field to a TEXT field but the truncate still happens.

    Anyone have any ideas?

  2. #2
    It's been real... Forbes's Avatar
    Join Date
    Dec 2004
    Location
    Yorkshire, England
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Post up your code and we'll take it from there...

  3. #3
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, really appreciate your reply. My code is as follow:

    PHP Code:
    $exif exif_read_data$photo);

            if( 
    $exif !== false )
            {
                foreach( 
    $exif as $name => $val )
                {
                    
    $raw  .= $name ': ' $val "\r\n";
                }
            }

    $sql mysql_query'INSERT INTO table values ("' addslashes$raw ) . '")' ); 

  4. #4
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    maybe if you set your field as a blob?

  5. #5
    It's been real... Forbes's Avatar
    Join Date
    Dec 2004
    Location
    Yorkshire, England
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you sure that the data only gets truncated when it goes into the database?

    If you're not sure, why not do a print_r() on the EXIF array to see what's in there...

  6. #6
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, i've tried blod it too got truncated.

    I'm sure the data got truncated as I always print_r my data before actually storing it to my database. I'd wish to cut and paste to you guys the EXIF data but whenever i try to copy and paste, the data got truncated as well. you can try the code with your image.

  7. #7
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anyone??

  8. #8
    It's been real... Forbes's Avatar
    Join Date
    Dec 2004
    Location
    Yorkshire, England
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by say
    Hi, i've tried blod it too got truncated.

    I'm sure the data got truncated as I always print_r my data before actually storing it to my database. I'd wish to cut and paste to you guys the EXIF data but whenever i try to copy and paste, the data got truncated as well. you can try the code with your image.
    I'm not sure what you're saying, reading this is a bit muddled.

    Are you saying that when you run the array variable through print_r() the output is truncated?

  9. #9
    SitePoint Addict say's Avatar
    Join Date
    Sep 2003
    Location
    At work
    Posts
    371
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Forbes,

    no, after i print_r and view source, the data are fully intact. But if i try to copy and paste to an editor or notepad, the data got truncated as well. I think it might be the problem of some character encoding issue?

  10. #10
    It's been real... Forbes's Avatar
    Join Date
    Dec 2004
    Location
    Yorkshire, England
    Posts
    676
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Now that is weird!

    Not being able to actually copy the data is a bit odd.

    That said, I've seen some odd characters before, such as the trademark or copyright symbol gettin' mangled, so it could be something like that.

    Does this only happen with this one image, or are you seeing the same problem with other images?


Bookmarks

Posting Permissions

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