Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Member ThePhoenix2006's Avatar
    Join Date
    Mar 2005
    Location
    Michigan
    Posts
    88
    Member #
    9431
    Hey there,

    I need to find a script to upload an image to a folder, then put the URL of the picture to the bandname it was submitted by. Also, when they submit a picture that a thumbnail be created and cropped so that when viewers search there is a picture?

    Is there anything or anyone out there that can help?

    I tried to read some stuff about this using GD or something but I still dont get what they want me to do with that.

    THANKS!!!!
    "Make sure the juice is worth the squeeze" ~The Girl Next Door

  2.  

  3. #2
    Senior Member hagen's Avatar
    Join Date
    Aug 2005
    Posts
    408
    Member #
    10882
    Liked
    1 times
    Use a form with the following field:

    <input type="file" name="imagefile">



    The processing before you save it can be done as follows using GD kit stuff:

    //################################################## ########################
    // display window 300 x 300. // imagecopyresized() copies a rectangular portion of one image to another image
    // These types will be automatically detected if your build of PHP supports
    // them: JPEG, PNG, GIF, WBMP, and GD2.
    //
    //
    $dest_photo_max_width = 300;
    $dest_photo_max_height = 300;



    if ($called_by == "form_add_picture") {
    if ($_FILES['imagefile']['size'] > 102400) {
    echo "File greater then 100K. Please upload a smaller file...";
    } else {

    //Open temporary file at server side
    $filename = $_FILES['imagefile']['tmp_name'];
    $fp = fopen($filename, "r");
    $binaryPhoto = fread($fp, filesize($filename));
    fclose($fp);

    $src_img = imagecreatefromstring($binaryPhoto); //create .jpg

    $src_width = imagesx($src_img); // get original source image width
    $src_height = imagesy($src_img); // and height
    if ($src_width > $src_height) {
    $dest_photo_width = $dest_photo_max_width;
    $dest_photo_height = ($src_height / $src_width) * $dest_photo_max_height;
    } else {
    $dest_photo_height = $dest_photo_max_height;
    $dest_photo_width = ($src_width / $src_height) * $dest_photo_max_width;
    }

    $dest_photo_img = imagecreatetruecolor($dest_photo_width, $dest_photo_height);


    imagecopyresized(
    $dest_photo_img, $src_img,
    0, 0, 0, 0,
    $dest_photo_width, $dest_photo_height,
    $src_width, $src_height);


    ob_start(); // Start capturing stdout.
    imageJPEG($dest_photo_img); // As though output to browser.
    $binary_photo = ob_get_contents(); // the raw jpeg image data.
    ob_end_clean(); // Dump the stdout so it does not screw other output.



    $tmp_photo = addslashes($binary_photo); //Escape necessary chars




    Now save it in a database or as a file...


    Then to display the thumbnail instanciate with HTML as follows:

    <img src="../picture_frame.php" >



    (Just use hight and width parameters to make thumbnail version....)


    In the picture frame file do this: echo $photo_blog;


    Hope that helps... It took me about a week to get all this to work!

    -Hagen
    Hagen Rose: hagen(at)jxwd(dot)co(dot)uk
    JX Web Development, Bournemouth, Dorset...JXWD.co.uk


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:47 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com