Results 1 to 10 of 10

Thread: Image Uploading

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Image Uploading

    I'm trying to think of the upload method I want to use for my news script.

    Right now, I have it so that when the user uploads a file, it renames the file to ####_##.ext, where #### is the news item ID (such as 42), ## is the image number (such as 2, since multiple images can be uploaded with each post), and ext is the extension, either .gif or .jpg.

    So if I'm posting an item and uploading two pictures, they would be renamed to: 42_1.gif and 42_2.gif

    I think this is a good method as it's also easy to determine which files were uploaded with each post, since the numbers before the _ will match the post ID.

    However, this can be confusing to anyone looking at the file names, as they're not very straightforward as to what the picture is.

    So should I keep my method, or should I just keep the name the user gives to it (and check to make sure that name isn't already used)? What method seems most beneficial?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  2. #2
    Lively Member
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    96
    if the news is only a picture.. it would be nice to know what the picture is about..
    you can add a field with a description,.?
    http://www.raketje.com coming..............soon................

  3. #3

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    ...? I have no idea what you're talking about.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  4. #4
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    You could have two different names, the original uploaded name and the news post assigned name, except there'd be a difference.

    I'll try to explain

    You have someone upload a file, say:

    hellothere.gif

    You're on the 42nd news post, and this is the first image, accordingly, you upload it as

    42_1.gif

    But, when you have that image in the newpost, get it to call another script, which will send back the name of the original image, in the header, but with 42_1.gif as the actual image

    You'd need another table for the original names, but I think that would work.

    Then the actual image on the page would be hellothere.gif but it'd be sourced from 42_1.gif and wouldn't affect the server side name of the image.

    Sort of understand ?

  5. #5

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I understand, but I'm not storing any of this in a database. Just in a folder on the server.

    The only link it has to the database is an image tag that would be in the news post.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    42_1_hellothere.gif

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    I hope you allow the uploading of PNGs too.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  8. #8

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by CornedBee
    I hope you allow the uploading of PNGs too.
    I don't even know what a PNG is, but if I had to guess...I'd say an image file format?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by da_silvy
    42_1_hellothere.gif
    I suppose I could do that. I just hope their image names aren't "this_is_a_picture_of_my_fish_that_sadly_died_last_winter.jpg"
    My evil laugh has a squeak in it.

    kristopherwilson.com

  10. #10
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    PNG (Portable Network Graphic, pronounced ping) is a W3C-approved image standard designed in 1995 to replace GIF, when the license troubles about GIF started.

    It is a lossless compression format for palettized (up to 256 colors) or true color (up to 16 bit per channel = 48-bit color) images with binary or full alpha (binary alpha is what GIF has, full alpha means partly transparent is also possible).
    Compression is about as good as GIF, usually even slightly better.

    Despite all advantages, Internet Explorer was so slow to pick up support for the format that PNG was nearly forgotten again - to this day IE needs a special trick to show transparent PNGs properly. A very special one.

    PNG is not capable of animations like GIF. There is a separate image format for that, known as MNG (Multiple Network Graphics), which again is far superior to Animated GIF, with the downside of requiring a very complex decoder and even more complex encoder.
    Support for this is virtually nil. Internet Explorer needs a special plug-in. Mozilla had native support, but it was taken out because of the size of the decoder. You can download special builds of Mozilla which still have it, or build your own. Konqueror supports it AFAIK, don't know about Opera and Safari.
    Usage therefore is nearly nil too. The default skin for Firebird used to use some MNG graphics, but they were changed to Animated GIF when MNG support was taken out of Mozilla.

    But PNG is now getting more popular again, and it would be a grave error to disallow uploading of this format.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width