Image Hosting.

Discussion in 'Web Programming' started by Synful, Aug 6, 2012.

Image Hosting.
  1. Unread #1 - Aug 6, 2012 at 4:17 AM
  2. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    Im looking for a simple image hosting software,

    Im new to websites ect and looking for something very basic where people can Upload an image from the computer to there gallery and then from that gallery post it on forums ect.
     
  3. Unread #2 - Aug 7, 2012 at 7:30 AM
  4. iJava
    Joined:
    Nov 21, 2011
    Posts:
    1,197
    Referrals:
    11
    Sythe Gold:
    485
    Discord Unique ID:
    220055593568829441

    iJava .Previously known as RSGoldRush
    $200 USD Donor New

    Image Hosting.

    Have you tried Google?
     
  5. Unread #3 - Aug 7, 2012 at 8:02 AM
  6. DMR
    Joined:
    Jun 27, 2011
    Posts:
    2,129
    Referrals:
    0
    Sythe Gold:
    15
    Discord Unique ID:
    285670177029226497
    Discord Username:
    dmr

    DMR Grand Master

    Image Hosting.

    There so much. You should have google'd it.

    tinypic
    photobucket

    to name a few.
     
  7. Unread #4 - Aug 7, 2012 at 4:21 PM
  8. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    You guys shouldn't post in the web programming section if you don't no what a script is...
     
  9. Unread #5 - Aug 7, 2012 at 7:16 PM
  10. Dial
    Joined:
    Jul 12, 2010
    Posts:
    5,739
    Referrals:
    32
    Sythe Gold:
    126
    Sythe's 10th Anniversary Two Factor Authentication User MushyMuncher Member of the Month Winner Easter 2015

    Dial Experienced Web Developer
    $200 USD Donor New Pirate PHP Programmers

    Image Hosting.

    Here's a very simple script taken from my old website. Feel free to edit it how you want, and ask any questions here if you need help using/understanding it.

    Put this form wherever you want it.

    Code:
    <form action="pictureupload.php" method="post" enctype="multipart/form-data">
    <input type="file" name="upload" value="" required="required" />
    <input type="submit" value="" />
    </form>
    
    Make a file called pictureupload.php and put this in it.

    PHP:
                        $target_path "/pathtoupload/";
                        
    //die($target_path);
                        //Owner: read/write, all else fail
                        
    chmod($target_path0777);
                        
    $error false;
                        
    //size check
                        
    if($_FILES['upload']['size'] > 500000000)
                        {
                            echo 
    '<META http-equiv="refresh" content="0; URL=errorpage.php">';
                        }
                        
                        
    $safe_extensions = array(
                            
    '.jpg',
                            
    '.jpeg',
                            
    '.png',
                            
    '.gif');
                        
                        
    //random name
                        
    $old_name $_FILES['upload']['name'];
                        
    $new_name md5(time());
                        
                        
    $ext stristr($old_name'.');
                        
                        if(!
    in_array($ext$safe_extensions))
                        {
                            echo 
    '<META http-equiv="refresh" content="0; URL=errorpage.php">';
                        }
                        
                        
    $target_path $target_path $new_name.$ext
                        
                        
                        if(!
    $error && move_uploaded_file($_FILES['upload']['tmp_name'], $target_path)) {

                            echo 
    '<META http-equiv="refresh" content="0; URL=successpage.php">'; }
    This was back a long time ago though, and echoing meta refresh isn't really good practice. You should look up how to use PHP header redirects and use those instead in those places.

    Edit:

    So you should replace any of this:

    Code:
    echo '<META http-equiv="refresh" content="0; URL=pagenamehere.php">';
    With this:

    PHP:
    header('Location: pagenamehere.php');
     
  11. Unread #6 - Aug 7, 2012 at 11:17 PM
  12. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Image Hosting.

    Simple and somewhat flawed unfortunately, but usable.

    I'll take a crack at it, what is your web host like? Free/shared or VPS?
     
  13. Unread #7 - Aug 8, 2012 at 12:01 AM
  14. Dial
    Joined:
    Jul 12, 2010
    Posts:
    5,739
    Referrals:
    32
    Sythe Gold:
    126
    Sythe's 10th Anniversary Two Factor Authentication User MushyMuncher Member of the Month Winner Easter 2015

    Dial Experienced Web Developer
    $200 USD Donor New Pirate PHP Programmers

    Image Hosting.

    Like I said, it was pretty old, and probably from a tutorial actually. What was flawed about it though, if you don't mind me asking?
     
  15. Unread #8 - Aug 8, 2012 at 12:25 AM
  16. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    Umm, Hostgator.com is where I bought it lol.


    Yeah, Its good when people post stuff like you did I find it easy to learn stuff when I have it in front of me. So thanks very much =)
     
  17. Unread #9 - Aug 8, 2012 at 12:37 AM
  18. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Image Hosting.

    PHP:
    chmod($target_path0777);
    You allow files to be executed, 664 would be a more appropriate permission for a file that is simply going to be read.

    PHP:
    $safe_extensions = array();
    You don't check the mime type being sent, only the extension. You could hide a script renamed as .jpg and run it directly (Unless you did a FORCED DOWNLOAD).



    Just some security issues to be mindful of.
     
  19. Unread #10 - Aug 8, 2012 at 12:38 AM
  20. Dial
    Joined:
    Jul 12, 2010
    Posts:
    5,739
    Referrals:
    32
    Sythe Gold:
    126
    Sythe's 10th Anniversary Two Factor Authentication User MushyMuncher Member of the Month Winner Easter 2015

    Dial Experienced Web Developer
    $200 USD Donor New Pirate PHP Programmers

    Image Hosting.

    Ah, thanks for that. I didn't really think of it.

    Hopefully you can write a new one for Synful then.
     
  21. Unread #11 - Aug 8, 2012 at 2:37 AM
  22. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    Hi Jazz if you could right me a very simple script that allows me to upload images then see the image link that would be great Im willing to pay if you could help me with this =)

    Thanks very much.
     
  23. Unread #12 - Aug 8, 2012 at 2:54 AM
  24. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Image Hosting.

    Just creating a nice script for you :)
    I'll reply back when it's done
     
  25. Unread #13 - Aug 8, 2012 at 7:33 AM
  26. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    Ok thank you very much.
     
  27. Unread #14 - Aug 8, 2012 at 4:54 PM
  28. matt_sells
    Joined:
    Nov 28, 2011
    Posts:
    78
    Referrals:
    0
    Sythe Gold:
    0

    matt_sells Member

    Image Hosting.

    Just an idea for you, since it seems that your programming knowledge is limited, use a cms for your site. not detracting from what jazz is doing, but you'll be able to find a "plugin" that will your visitors to upload images, but with a cms you will also be able to do the things you probably cant atm, e.g. seo, allow for people signing up, for private access to galleries, etc etc etc. So for something that would cost you a few hundred quid, you could pretty much do yourself in a day for free.

    As for a cms to use, if you wish to, I'm biased and always say wordpress, because it suits me best but joomla, drupal etc would work very well for this type of site(presuming you want to spam it out with ads)

    Also with "some" experience in this type of website, make sure you have a disclaimer when people upload stuff, otherwise copyright is your problem = bad thing.
     
  29. Unread #15 - Aug 8, 2012 at 5:08 PM
  30. novice
    Joined:
    Jun 21, 2008
    Posts:
    111
    Referrals:
    0
    Sythe Gold:
    0

    novice Active Member

    Image Hosting.

    Is it shared, VPS or dedicated? Hostgator doesn't allow image hosting scripts on shared hosting.

    http://www.hostgator.com/tos/tos.php
     
  31. Unread #16 - Aug 8, 2012 at 5:53 PM
  32. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

  33. Unread #17 - Aug 8, 2012 at 10:54 PM
  34. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Image Hosting.

    Here's what I have so far: Upload Gallery

    Still needs some work on
    • user detection
    • gallery
    • error catching on display pages
     
  35. Unread #18 - Aug 9, 2012 at 1:00 AM
  36. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    thanks jazz looks really really good so far =)
     
  37. Unread #19 - Aug 9, 2012 at 9:24 PM
  38. Jazz00006
    Joined:
    Aug 26, 2005
    Posts:
    807
    Referrals:
    0
    Sythe Gold:
    0

    Jazz00006 Apprentice
    Visual Basic Programmers

    Image Hosting.

    Oh boy, here we go. Hopefully we can keep this thread civil from now on? (Both sides please)



    I might not be able make much progress today with work and all, but the next item on my agenda is the gallery.

    Then I'll clean up the code and throw in the last bits of error checking.



    Questions, comments or complaints so far?
     
  39. Unread #20 - Aug 9, 2012 at 9:44 PM
  40. Synful
    Joined:
    May 24, 2012
    Posts:
    441
    Referrals:
    0
    Sythe Gold:
    0

    Synful Dragon Slayer
    Banned

    Image Hosting.

    its perfect man, its exactly what Im after. Thanks very very much. =)
     
< Dreamweaver | Enjin Professional Needed - Minecraft site >

Users viewing this thread
1 guest


 
 
Adblock breaks this site