Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    England =)
    Posts
    523
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Content-type: image/pjpeg - help :(

    hi all,

    im aware of the problems with uploading jpegs with IE... they are all stored as pjpeg. i have searched google a lot - the problem is well documented but i cant find a solution to it!?!?

    how can i stop this? the problem is that when saved back form the system they cannot be viewed by anything... even the MS image viewer thingy!

    this is really annoying as progressive jpegs are rarely used anywhere!

    my code for the download:

    PHP Code:
    <?php
    if(isset($_GET['id'])) {
        
    // if id is set then get the file with the id from database
        
        
    include 'config.php';
        include 
    'opendb.php';
        
    $id    $_GET['id'];
        
    $query "SELECT name, type, size, content FROM upload WHERE id = '$id'";
        
        
    $result mysql_query($query) or die('Error, query failed');
        list(
    $name$type$size$content) = mysql_fetch_array($result);
        
        if (
    $type == 'image/pjpeg') {
            
    $type 'image/jpeg';
        }
        
        
    header("Content-length: $size");
        
    header("Content-type: $type");
        
    header("Content-Disposition: attachment; filename=$name");
        echo 
    $content;
        
        include 
    'closedb.php'
        exit;
    }
    ?>
    as you can see i even try to translate this for the download - no luck. i then try to adjust a file in the db to be image/jpeg and it still doesnt work!

    wtf!!
    "They hired me for my motivational skills. Everyone at work says they have to work much harder when I`m around" Homer J Simpson

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    England =)
    Posts
    523
    Thanks
    26
    Thanked 0 Times in 0 Posts
    bump

    supposed to be going live monday! eek!
    "They hired me for my motivational skills. Everyone at work says they have to work much harder when I`m around" Homer J Simpson

  • #3
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Are you sure the image has been inserted into the table properly?

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    England =)
    Posts
    523
    Thanks
    26
    Thanked 0 Times in 0 Posts
    yup... all other files i upload work ok - just jpegs that have the problem....

    normally people wouldnt store jpegs in there but sometimes they might
    "They hired me for my motivational skills. Everyone at work says they have to work much harder when I`m around" Homer J Simpson

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,548
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    The only thing you can do is determine if it's pjpeg and return back telling
    the user that you don't allow pjpeg.

    Progressive JPEG's are created on a user's PC (using some photo editors).
    For those that don't know what they are ... in the days of mostly slow dial-up,
    progressive JPEGs cause the whole image to appear in sort of a "fade-in" mode.
    It looks better than a blank image filling from top to bottom.

    They are no longer used much anymore ... most people now have hi-speed.

    So, the creation of them is a part of Windows and photo editors.

    If someone uses IRFan or Snag-It or something to edit or resize photos, they
    save them as JPEG and they will be uploaded as JPEG even if they upload
    using IE6 or IE7.

    I use IE to upload JPEGs all the time and have never had any problems with it.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    England =)
    Posts
    523
    Thanks
    26
    Thanked 0 Times in 0 Posts
    seems to be any image file that is saved when i look more into it. including tiff and GIF?

    hmmmmm - more digging i think!
    "They hired me for my motivational skills. Everyone at work says they have to work much harder when I`m around" Homer J Simpson

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,548
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    I wonder if this is a php config file issue with your server.
    Not sure if they have a place to enable/disable pjpeg.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    England =)
    Posts
    523
    Thanks
    26
    Thanked 0 Times in 0 Posts
    its happening tho with GIG and TIFF also... not sure what is wrong...

    im re doing it with filesystem over blobs anyway - its been too much of a pain in the backside!
    "They hired me for my motivational skills. Everyone at work says they have to work much harder when I`m around" Homer J Simpson


  •  

    Posting Permissions

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