SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: GD help !!

  1. #1
    psycho
    Join Date
    May 2000
    Location
    London
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there.

    I would like some help regarding Imagegif() and outputting it to a file, instead of sending it just to the browser. Here is some code I'm using to resize an image uploaded by the user :


    if ($submit) {

    if ($img1_name != "") {

    copy("$img1", "/home/hiphop/hiphopmusic-www/images/fp/$img1_name");
    $type = GetImageSize("/home/hiphop/hiphopmusic-www/images/fp/$img1_name");


    if ($type[2] > 1) {
    echo("<font face='verdana' size='4'>Your image must be in GIF format.</font>");
    unlink("/home/hiphop/hiphopmusic-www/images/fp/$img1_name");

    exit();
    }

    else {

    //RESIZE
    $new_w=70;
    $new_h=70;

    header("Content-type: image/gif");

    $dst_img=ImageCreate($new_w,$new_h);

    $src_img=ImageCreateFromGif("/home/hiphop/hiphopmusic-www/images/fp/$img1_name");

    ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
    $pic=ImageGif($dst_img);

    copy("$pic", "/home/hiphop/hiphopmusic-www/images/fp/$img1_name");

    //END




    $date = date("d : m : Y");
    mysql_connect("localhost","xxx","xxx");
    mysql_select_db("xxx");
    mysql_query("

    INSERT INTO FP SET
    name='$name',
    email='$email',
    title='$title',
    summary='$summary',
    imgurl='http://www.hiphopmusic.co.uk/images/fp/$img1_name',
    date='$date',
    validated='0'

    ");

    }


    Thanks,
    J

  2. #2
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So what is the problem or thing you're trying to do or encountering? You didn't mention it so....
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy


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
  •