Help for this page

Select Code to Download


  1. or download this
    my $white;
    # Create background
    my $image = new GD::Image(600, 450);
    $white = $image->colorAllocate(255, 255, 255);
    $image->filledRectangle(0, 0, 600, 450, $white);
    
  2. or download this
    $white = $image->colorAllocate(127, 127, 127);
    $image->filledRectangle(0, 0, 600, 450, $white);
    
  3. or download this
    open my $fh, '>' ,"$root/images/property/unit/$filename.png";
    binmode $fh;
    print $fh $image->png;
    close $fh;
    
  4. or download this
    # Resize uploaded image to 600 wide
    my $picture = GD::Image->new($file{'image', 'file'});
    ...
    $newh = int ($srch * 600 / $srcw);
    my $resize = GD::Image->new(600, $newh);
    $resize->copyResized($picture, 0, 0, 0, 0, 600, $newh, $srcw, $srch);
    
  5. or download this
    open my $fh, '>' ,"$root/images/property/unit/$filename.png";
    binmode $fh;
    print $fh $resize->png;
    close $fh;
    
  6. or download this
    # Copy onto background image offset to crop or center
    $image->copy($resize, 0, 0, 0, ($newh - 450) / 2, 600, 450);
    
  7. or download this
    open my $fh, '>' ,"$root/images/property/unit/$filename.png";
    binmode $fh;
    print $fh $image->png;
    close $fh;