class.upload.php samples, a files uploading and images manipulation PHP class

These images are created by the class.upload.php test suite, that you can download part of the package.

original file

image/png  -  150 x 100  -  35.25KB

width 50, height auto

image/png  -  50 x 33  -  4.5KB

$foo->image_resize          = true;
$foo->image_ratio_y         = true;
$foo->image_x               = 50;
height 50, width auto

image/png  -  75 x 50  -  9.75KB

$foo->image_resize          = true;
$foo->image_ratio_x         = true;
$foo->image_y               = 50;
height 50, width 50

image/png  -  50 x 50  -  6.75KB

$foo->image_resize          = true;
$foo->image_y               = 50;
$foo->image_x               = 50;
height 50, width 50, keeping ratio

image/png  -  50 x 33  -  4.5KB

$foo->image_resize          = true;
$foo->image_ratio           = true;
$foo->image_y               = 50;
$foo->image_x               = 50;
50x50, keeping ratio, cropping excedent

image/png  -  50 x 50  -  6.75KB

$foo->image_resize          = true;
$foo->image_ratio_crop      = true;
$foo->image_y               = 50;
$foo->image_x               = 50;
50x50, keeping ratio, cropping right excedent

image/png  -  50 x 50  -  7KB

$foo->image_resize          = true;
$foo->image_ratio_crop      = 'L';
$foo->image_y               = 50;
$foo->image_x               = 50;
50x50, keeping ratio, cropping left excedent

image/png  -  50 x 50  -  6.5KB

$foo->image_resize          = true;
$foo->image_ratio_crop      = 'R';
$foo->image_y               = 50;
$foo->image_x               = 50;
150x50, keeping ratio, filling in

image/png  -  150 x 50  -  10KB

$foo->image_resize          = true;
$foo->image_ratio_fill      = true;
$foo->image_y               = 50;
$foo->image_x               = 150;
150x50, keeping ratio, filling left side

image/png  -  150 x 50  -  10KB

$foo->image_resize          = true;
$foo->image_ratio_fill      = 'L';
$foo->image_y               = 50;
$foo->image_x               = 150;
100x150, keeping ratio, filling top and bottom

image/png  -  100 x 150  -  15.75KB

$foo->image_resize          = true;
$foo->image_ratio_fill      = 'R';
$foo->image_y               = 150;
$foo->image_x               = 100;
$foo->image_background_color = '#FF00FF';
height 50, width 50, cropped, using ratio_crop

image/png  -  30 x 50  -  4.25KB

$foo->image_resize          = true;
$foo->image_ratio_crop      = true;
$foo->image_crop            = '0 10';
$foo->image_y               = 50;
$foo->image_x               = 50;
calculates x and y, targeting 25000 pixels

image/png  -  194 x 129  -  51.75KB

$foo->image_resize          = true;
$foo->image_ratio_pixels    = 25000;
calculates x and y, targeting 10000 pixels

image/png  -  122 x 82  -  23.25KB

$foo->image_resize          = true;
$foo->image_ratio_pixels    = 10000;
20% crop

image/png  -  90 x 60  -  12.75KB

$foo->image_crop            = '20%';
5px vertical and 20% horizontal crop

image/png  -  90 x 90  -  20KB

$foo->image_crop            = '5 20%';
negative crop with a background color

image/png  -  180 x 106  -  34KB

$foo->image_crop            = '-3px -10%';
$foo->image_background_color = '#FF00FF';
5px top, 40px right, 10% bot. and -20px left crop

image/png  -  130 x 85  -  24.25KB

$foo->image_crop            = '5 40 10% -20';
15px pre-cropping (before resizing 150 wide)

image/png  -  150 x 88  -  26.75KB

$foo->image_resize          = true;
$foo->image_ratio_y         = true;
$foo->image_x               = 150;
$foo->image_precrop         = 15;
diverse pre-cropping (before resizing 150 wide)

image/png  -  150 x 98  -  26KB

$foo->image_resize          = true;
$foo->image_ratio_y         = true;
$foo->image_x               = 150;
$foo->image_precrop         = '25 70 10% -20';
90 degrees rotation

image/png  -  100 x 150  -  34.75KB

$foo->image_rotate          = '90';
180 degrees rotation

image/png  -  150 x 100  -  35.25KB

$foo->image_rotate          = '180';
horizontal flip, into WEBP file

image/webp  -  150 x 100  -  6.75KB

$foo->image_convert         = 'webp';
$foo->image_flip            = 'H';
vertical flip, into GIF file

image/gif  -  150 x 100  -  10.75KB

$foo->image_convert         = 'gif';
$foo->image_flip            = 'V';
180 degrees rotation, into GIF, green bg

image/x-ms-bmp  -  150 x 100  -  44.25KB

$foo->image_convert         = 'gif';
$foo->image_default_color   = '#00FF00';
$foo->image_rotate          = '180';
90 degrees rotation and horizontal flip, into PNG

image/png  -  100 x 150  -  34.75KB

$foo->image_convert         = 'png';
$foo->image_flip            = 'H';
$foo->image_rotate          = '90';
20px black and white bevel

image/png  -  150 x 100  -  31KB

$foo->image_bevel           = 20;
$foo->image_bevel_color1    = '#FFFFFF';
$foo->image_bevel_color2    = '#000000';
5px white bevel (smooth border)

image/png  -  150 x 100  -  33.75KB

$foo->image_bevel           = 5;
$foo->image_bevel_color1    = '#FFFFFF';
$foo->image_bevel_color2    = '#FFFFFF';
5px red border

image/png  -  160 x 110  -  35.75KB

$foo->image_border          = 5;
$foo->image_border_color    = '#FF0000';
5px green semi-transparent border

image/png  -  160 x 110  -  35.75KB

$foo->image_border          = 5;
$foo->image_border_color    = '#00FF00';
$foo->image_border_opacity  = 50;
5px top, 20px right, 1px bot. and 25% left blue border

image/png  -  207 x 106  -  35.75KB

$foo->image_border          = '5 20 1 25%';
$foo->image_border_color    = '#0000FF';
flat colored frame, 4 px wide

image/png  -  158 x 108  -  35.5KB

$foo->image_frame           = 1;
$foo->image_frame_colors    = '#FF0000 #FFFFFF
                               #FFFFFF #0000FF';
crossed colored frame, 7 px wide

image/png  -  164 x 114  -  35.5KB

$foo->image_frame           = 2;
$foo->image_frame_colors    = '#FFFFFF #BBBBBB
                               #999999 #FF0000
                               #666666 #333333
                               #000000';
flat colored frame, 4 px wide, 25% opacity

image/png  -  158 x 108  -  35.5KB

$foo->image_frame           = 1;
$foo->image_frame_colors    = '#FF0000 #FF00FF
                               #0000FF #000000';
$foo->image_frame_opacity   = 25;
10px fade-to-transparent border

image/png  -  150 x 100  -  35.5KB

$foo->image_border_transparent = 10;
various fade-to-transparent borders

image/png  -  150 x 100  -  35.75KB

$foo->image_border_transparent = '10 50 20 60';
right fading-out to transparency mask

image/png  -  150 x 100  -  35.25KB

$foo->image_border_transparent = array(0, 150, 0, 0);
tint and 50% overlay and 180' rotation

image/png  -  150 x 100  -  8.25KB

$foo->image_overlay_color   = '#FFFFFF';
$foo->image_overlay_opacity = 50;
$foo->image_rotate          = '180';
$foo->image_tint_color      = '#FF0000';
#FF0000 tint

image/png  -  150 x 100  -  19KB

$foo->image_tint_color      = '#FF0000';
50% overlay #FF0000

image/png  -  150 x 100  -  29.5KB

$foo->image_overlay_color   = '#FF0000';
$foo->image_overlay_opacity = 50;
5% overlay #0000FF

image/png  -  150 x 100  -  34.75KB

$foo->image_overlay_color   = '#0000FF';
$foo->image_overlay_opacity = 5;
90% overlay #FFFFFF

image/png  -  150 x 100  -  18.5KB

$foo->image_overlay_color   = '#FFFFFF';
$foo->image_overlay_opacity = 90;
brightness 25

image/png  -  150 x 100  -  34.5KB

$foo->image_brightness      = 25;
brightness -25

image/png  -  150 x 100  -  29.75KB

$foo->image_brightness      = -25;
contrast 75

image/png  -  150 x 100  -  34.75KB

$foo->image_contrast        = 75;
opacity 75

image/png  -  150 x 100  -  35.25KB

$foo->image_opacity         = 75;
opacity 25

image/png  -  150 x 100  -  34.75KB

$foo->image_opacity         = 25;
threshold filter

image/png  -  150 x 100  -  7.5KB

$foo->image_threshold       = 20;
greyscale

image/png  -  150 x 100  -  28.25KB

$foo->image_greyscale       = true;
negative

image/png  -  150 x 100  -  35KB

$foo->image_negative        = true;
original file, again

image/png  -  150 x 100  -  35.25KB

pixelate, 3px block size

image/png  -  150 x 100  -  15KB

$foo->image_pixelate        = 3;
pixelate, 10px block size

image/png  -  150 x 100  -  8KB

$foo->image_pixelate        = 10;
unsharp mask, default values

image/png  -  150 x 100  -  39.25KB

$foo->image_unsharp         = true;
unsharp mask, different values

image/png  -  150 x 100  -  37.75KB

$foo->image_unsharp         = true;
$foo->image_unsharp_amount  = 200;
$foo->image_unsharp_radius  = 1;
$foo->image_unsharp_threshold = 5;
brightness, resize, rotation, overlay & label

image/png  -  200 x 100  -  16.25KB

$foo->image_brightness      = 75;
$foo->image_resize          = true;
$foo->image_y               = 200;
$foo->image_x               = 100;
$foo->image_rotate          = '90';
$foo->image_overlay_color   = '#FF0000';
$foo->image_overlay_opacity = 50;
$foo->image_text            = 'verot.net';
$foo->image_text_color      = '#0000FF';
$foo->image_text_background = '#FFFFFF';
$foo->image_text_position   = 'BL';
$foo->image_text_padding_x  = 10;
$foo->image_text_padding_y  = 2;
overlayed transparent label

image/png  -  150 x 100  -  31.75KB

$foo->image_text            = 'verot.net';
$foo->image_text_color      = '#000000';
$foo->image_text_opacity    = 80;
$foo->image_text_background = '#FFFFFF';
$foo->image_text_background_opacity = 70;
$foo->image_text_font       = 5;
$foo->image_text_padding    = 20;
overlayed vertical plain label bottom left

image/png  -  150 x 100  -  32.75KB

$foo->image_text            = 'verot.net';
$foo->image_text_direction  = 'v';
$foo->image_text_background = '#000000';
$foo->image_text_font       = 2;
$foo->image_text_position   = 'BL';
$foo->image_text_padding_x  = 2;
$foo->image_text_padding_y  = 8;
overlayed vertical label, into BMP

image/x-ms-bmp  -  150 x 100  -  44.25KB

$foo->image_convert         = 'bmp';
$foo->image_text            = 'verot.net';
$foo->image_text_direction  = 'v';
$foo->image_text_color      = '#FFFFFF';
$foo->image_text_background = '#000000';
$foo->image_text_background_opacity = 50;
$foo->image_text_padding    = 5;
overlayed label with absolute negative position

image/png  -  150 x 100  -  31.5KB

$foo->image_text            = 'verot.net';
$foo->image_text_opacity    = 50;
$foo->image_text_background  = '#0000FF';
$foo->image_text_x          = -5;
$foo->image_text_y          = -5;
$foo->image_text_padding    = 5;
overlayed transparent label with absolute position

image/png  -  150 x 100  -  34KB

$foo->image_text            = 'verot.net';
$foo->image_text_background = '#0000FF';
$foo->image_text_background_opacity = 25;
$foo->image_text_x          = 5;
$foo->image_text_y          = 5;
$foo->image_text_padding    = 20;
text label with multiple lines and small font

image/png  -  150 x 100  -  33.25KB

$foo->image_text            = "verot.net\nclass\nupload";
$foo->image_text_background = '#000000';
$foo->image_text_background_opacity = 75;
$foo->image_text_font       = 1;
$foo->image_text_padding    = 10;
vertical multi-lines text, right aligned

image/png  -  150 x 100  -  33.5KB

$foo->image_text            = "verot.net\nclass\nupload";
$foo->image_text_color      = '#000000';
$foo->image_text_background = '#FFFFFF';
$foo->image_text_background_opacity = 60;
$foo->image_text_padding    = 3;
$foo->image_text_font       = 3;
$foo->image_text_alignment  = 'R';
$foo->image_text_direction  = 'V';
text label with 10 pixels of line spacing

image/png  -  150 x 100  -  32.25KB

$foo->image_text            = "verot.net\nclass\nupload";
$foo->image_text_background = '#000000';
$foo->image_text_background_opacity = 50;
$foo->image_text_padding    = 10;
$foo->image_text_x          = -5;
$foo->image_text_y          = -5;
$foo->image_text_line_spacing = 10;
text label in a black line, plus unsharp mask

image/png  -  150 x 116  -  39.5KB

$foo->image_unsharp         = true;
$foo->image_border          = '0 0 16 0';
$foo->image_border_color    = '#000000';
$foo->image_text            = "verot.net";
$foo->image_text_font       = 2;
$foo->image_text_position   = 'B';
$foo->image_text_padding_y  = 2;
using tokens in text labels

image/png  -  156 x 133  -  34.25KB

$foo->image_crop            = '-3 -3 -30 -3';
$foo->image_text            = "[dst_name] [dst_x]x[dst_y]";
$foo->image_text_background = '#6666ff';
$foo->image_text_color      = '#ffffff';
$foo->image_background_color= '#000099';
$foo->image_text_font       = 2;
$foo->image_text_y          = -7;
$foo->image_text_padding_x  = 3;
$foo->image_text_padding_y  = 2;
all the tokens available

image/png  -  180 x 355  -  39.75KB

$foo->image_crop            = '-15 -15 -240 -15';
$foo->image_text            = 
   "token          value\n
    -------------  ------------------\n
    src_name       [src_name]\n
    src_name_body  [src_name_body]\n
    src_name_ext   [src_name_ext]\n
    src_pathname   [src_pathname]\n
    src_mime       [src_mime]\n
    src_type       [src_type]\n
    src_bits       [src_bits]\n
    src_pixels     [src_pixels]\n
    src_size       [src_size]\n
    src_size_kb    [src_size_kb]\n
    src_size_mb    [src_size_mb]\n
    src_size_human [src_size_human]\n
    src_x          [src_x]\n
    src_y          [src_y]\n
    dst_path       [dst_path]\n
    dst_name_body  [dst_name_body]\n
    dst_name_ext   [dst_name_ext]\n
    dst_name       [dst_name]\n
    dst_pathname   [dst_pathname]\n
    dst_x          [dst_x]\n
    dst_y          [dst_y]\n
    date           [date]\n
    time           [time]\n
    host           [host]\n
    server         [server]\n
    ip             [ip]\n
    gd_version     [gd_version]";
$foo->image_text_alignment  = 'L';
$foo->image_text_font       = 1;
$foo->image_text_position   = 'B';
$foo->image_text_padding_y  = 5;
$foo->image_text_color      = '#000000';
text label with external GDF font

image/png  -  150 x 100  -  21.25KB

$foo->image_text            = "verot.net\nclass\nupload";
$foo->image_text_background = '#000000';
$foo->image_text_padding    = 10;
$foo->image_text_font       = "./foo.gdf";
$foo->image_text_line_spacing = 2;
text label with external GDF font

image/png  -  150 x 100  -  31KB

$foo->image_text            = 'PHP';
$foo->image_text_color      = '#FFFF00';
$foo->image_text_background = '#FF0000';
$foo->image_text_padding    = 10;
$foo->image_text_font       = "./foo.gdf";
UTF-8 text label with external TTF font

image/png  -  150 x 100  -  26.25KB

$foo->image_text            = "àzértyuïôp";
$foo->image_text_background = '#000000';
$foo->image_text_padding    = 10;
$foo->image_text_font       = "./foo.ttf";
UTF-8 text label with external TTF font

image/png  -  150 x 100  -  25.75KB

$foo->image_text            = "άλφα\nβήτα";
$foo->image_text_color      = '#0033CC';
$foo->image_text_size       = 28;
$foo->image_text_font       = "./foo.ttf";
$foo->image_overlay_color   = '#FFFFFF';
$foo->image_overlay_opacity = 75;
UTF-8 text label with external TTF font

image/png  -  150 x 100  -  17.5KB

$foo->image_text            = "люблю";
$foo->image_text_background = '#000000';
$foo->image_text_size       = 20;
$foo->image_text_angle      = 20;
$foo->image_text_padding    = 10;
$foo->image_text_font       = "./foo.ttf";
40px reflection

image/png  -  150 x 142  -  48KB

$foo->image_reflection_height = '40px';
text label and 50% reflection

image/png  -  150 x 152  -  22.75KB

$foo->image_text            = "verot.net\nclass\nupload";
$foo->image_text_background = '#000000';
$foo->image_text_padding    = 10;
$foo->image_text_line_spacing = 10;
$foo->image_reflection_height = '50%';
40px reflection and 10 pixels space, into JPEG

image/jpeg  -  150 x 150  -  8.25KB

$foo->image_convert         = 'jpg';
$foo->image_reflection_height = '40px';
$foo->image_reflection_space = 10;
60px reflection and -40 pixels space

image/png  -  150 x 120  -  45.5KB

$foo->image_reflection_height = 60;
$foo->image_reflection_space = -40;
50px reflection and 100% opacity

image/png  -  150 x 152  -  51.25KB

$foo->image_reflection_height = 50;
$foo->image_reflection_opacity = 100;
50px reflection and 20% opacity

image/png  -  150 x 152  -  51KB

$foo->image_reflection_height = 50;
$foo->image_reflection_opacity = 20;
50% reflection, black background

image/png  -  150 x 152  -  51.25KB

$foo->image_reflection_height = '50%';
$foo->image_default_color    = '#000000';
50% reflection, pink background, into GIF

image/gif  -  150 x 152  -  12.5KB

$foo->image_convert         = 'gif';
$foo->image_reflection_height = '50%';
$foo->image_default_color    = '#000000';
overlayed watermark (alpha transparent PNG)

image/png  -  150 x 100  -  35.25KB

$foo->image_watermark       = 'watermark.png';
overlayed watermark, right position

image/png  -  150 x 100  -  36KB

$foo->image_watermark       = 'watermark.png';
$foo->image_watermark_position = 'R;
watermark on greyscale pic, absolute position

image/png  -  150 x 100  -  29.25KB

$foo->image_watermark       = 'watermark.png';
$foo->image_watermark_x     = 10;
$foo->image_watermark_y     = 10;
$foo->image_greyscale       = true;
watermark, automatic up-resizing activated

image/png  -  150 x 100  -  33.5KB

$foo->image_watermark       = 'watermark.png';
$foo->image_watermark_no_zoom_in = false;
large watermark automatically reduced (default)

image/png  -  150 x 100  -  35KB

$foo->image_watermark       = 'watermark_large.png';
large watermark, automatic down-resizing deactivated

image/png  -  150 x 100  -  33.5KB

$foo->image_watermark       = 'watermark_large.png';
$foo->image_watermark_no_zoom_out = true;
large watermark, down-resizing deactivated, position top-left

image/png  -  150 x 100  -  32.5KB

$foo->image_watermark       = 'watermark_large.png';
$foo->image_watermark_no_zoom_out = true;
$foo->image_watermark_position = 'TL'
large watermark automatically reduced, position 20 -20

image/png  -  150 x 100  -  36.5KB

$foo->image_watermark       = 'watermark_large.png';
$foo->image_watermark_x     = 20;
$foo->image_watermark_y     = -20;
desired JPEG size set to 3KB

image/jpeg  -  150 x 100  -  3KB

$foo->image_convert         = 'jpg';
$foo->jpeg_size             = 3072;
JPG quality set to 10%

image/jpeg  -  150 x 100  -  1.75KB

$foo->image_convert         = 'jpg';
$foo->jpeg_quality          = 10;
JPG quality set to 80%

image/jpeg  -  150 x 100  -  6KB

$foo->image_convert         = 'jpg';
$foo->jpeg_quality          = 80;
PNG compression set to 0 (fast, large files)

image/png  -  150 x 100  -  58.75KB

$foo->image_convert         = 'png';
$foo->png_compression       = 0;
PNG compression set to 9 (slow, smaller files)

image/png  -  150 x 100  -  35.25KB

$foo->image_convert         = 'png';
$foo->png_compression       = 9;
WEBP quality set to 10%

image/webp  -  150 x 100  -  2.5KB

$foo->image_convert         = 'webp';
$foo->webp_quality          = 10;
WEBP quality set to 80%

image/webp  -  150 x 100  -  6KB

$foo->image_convert         = 'webp';
$foo->webp_quality          = 80;