Giter Club home page Giter Club logo

verot / class.upload.php Goto Github PK

View Code? Open in Web Editor NEW
841.0 78.0 362.0 641 KB

This PHP class uploads files and manipulates images very easily. It is in fact as much as an image processing class than it is an upload class. Compatible with PHP 4, 5, 7 and 8. Supports processing of local files, uploaded files, files sent through XMLHttpRequest.

Home Page: http://www.verot.net/php_class_upload.htm

License: GNU General Public License v2.0

PHP 98.37% HTML 1.63%

class.upload.php's Introduction

class.upload.php

Homepage : http://www.verot.net/php_class_upload.htm

Demo : http://www.verot.net/php_class_upload_samples.htm

Donations: http://www.verot.net/php_class_upload_donate.htm

Commercial use: http://www.verot.net/php_class_upload_license.htm

What does it do?

This class manages file uploads for you. In short, it manages the uploaded file, and allows you to do whatever you want with the file, especially if it is an image, and as many times as you want.

It is the ideal class to quickly integrate file upload in your site. If the file is an image, you can convert, resize, crop it in many ways. You can also apply filters, add borders, text, watermarks, etc... That's all you need for a gallery script for instance. Supported formats are PNG, JPG, GIF, WEBP and BMP.

You can also use the class to work on local files, which is especially useful to use the image manipulation features. The class also supports Flash uploaders and XMLHttpRequest.

The class works with PHP 5.3+, PHP 7 and PHP 8 (use version 1.x for PHP 4 support), and its error messages can be localized at will.

Install via composer

Edit your composer.json file to include the following:

    {
       "require": {
           "verot/class.upload.php": "*"
       }
    }

Or install it directly:

    composer require verot/class.upload.php

Demo and examples

Check out the test/ directory, which you can load in your browser. You can test the class and its different ways to instantiate it, see some code examples, and run some tests.

How to use it?

Create a simple HTML file, with a form such as:

<form enctype="multipart/form-data" method="post" action="upload.php">
  <input type="file" size="32" name="image_field" value="">
  <input type="submit" name="Submit" value="upload">
</form>

Create a file called upload.php (into which you have first loaded the class):

$handle = new \Verot\Upload\Upload($_FILES['image_field']);
if ($handle->uploaded) {
  $handle->file_new_name_body   = 'image_resized';
  $handle->image_resize         = true;
  $handle->image_x              = 100;
  $handle->image_ratio_y        = true;
  $handle->process('/home/user/files/');
  if ($handle->processed) {
    echo 'image resized';
    $handle->clean();
  } else {
    echo 'error : ' . $handle->error;
  }
}

How does it work?

You instanciate the class with the $_FILES['my_field'] array where my_field is the field name from your upload form. The class will check if the original file has been uploaded to its temporary location (alternatively, you can instanciate the class with a local filename).

You can then set a number of processing variables to act on the file. For instance, you can rename the file, and if it is an image, convert and resize it in many ways. You can also set what will the class do if the file already exists.

Then you call the function process() to actually perform the actions according to the processing parameters you set above. It will create new instances of the original file, so the original file remains the same between each process. The file will be manipulated, and copied to the given location. The processing variables will be reset once it is done.

You can repeat setting up a new set of processing variables, and calling process() again as many times as you want. When you have finished, you can call clean() to delete the original uploaded file.

If you don't set any processing parameters and call process() just after instanciating the class. The uploaded file will be simply copied to the given location without any alteration or checks.

Don't forget to add enctype="multipart/form-data" in your form tag <form> if you want your form to upload the file.

Namespacing

The class is now namespaced in the Verot/Upload namespace. If you have the error Fatal error: Class 'Upload' not found, then use the class fully qualified name, or instantiate the class with its fully qualified name:

use Verot\Upload\Upload;
$handle = new Upload($_FILES['image_field']);

or

$handle = new \Verot\Upload\Upload($_FILES['image_field']);

How to process local files?

Instantiate the class with the local filename, as following:

$handle = new Upload('/home/user/myfile.jpg');

How to process a file uploaded via XMLHttpRequest?

Instantiate the class with the special php: keyword, as following:

$handle = new Upload('php:'.$_SERVER['HTTP_X_FILE_NAME']);

Prefixing the argument with php: tells the class to retrieve the uploaded data in php://input, and the rest is the stream's filename, which is generally in $_SERVER['HTTP_X_FILE_NAME']. But you can use any other name you see fit:

$handle = new Upload('php:mycustomname.ext');

How to process raw file data?

Instantiate the class with the special data: keyword, as following:

$handle = new Upload('data:'.$file_contents);

If your data is base64-encoded, the class provides a simple base64: keyword, which will decode your data prior to using it:

$handle = new Upload('base64:'.$base64_file_contents);

How to set the language?

Instantiate the class with a second argument being the language code:

$handle = new Upload($_FILES['image_field'], 'fr_FR');
$handle = new Upload('/home/user/myfile.jpg', 'fr_FR');

How to output the resulting file or picture directly to the browser?

Simply call process() without an argument (or with null as first argument):

$handle = new Upload($_FILES['image_field']);
header('Content-type: ' . $handle->file_src_mime);
echo $handle->process();
die();

Or if you want to force the download of the file:

$handle = new Upload($_FILES['image_field']);
header('Content-type: ' . $handle->file_src_mime);
header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");
echo $handle->process();
die();

Warning about security

By default, the class relies on MIME type detection to assess whether the file can be uploaded or not. Several MIME type detection methods are used, depending on the server configuration. The class relies on a blacklist of dangerous file extensions to prevent uploads (or to rename dangerous scripts as text files), as well as a whitelist of accepted MIME types.

But it is not the purpose of this class to do in-depth checking and heuristics to attempt to detect maliciously crafted files. For instance, an attacker can craft a file that will have the correct MIME type, but will carry a malicious payload, such as a valid GIF file which would contain some code leading to a XSS vulnerability. If this GIF file has a .html extension, it may be uploaded (depending on the class's settings) and display an XSS vulnerability.

However, you can mitigate this by restricting the kind of files that can be uploaded, using allowed and forbidden, to whitelist and blacklist files depending on their MIME type or extension. The most secure option would be to only whitelist extensions that you want to allow through, and then making sure that your server always serves the file with the content-type based on the file extension.

For instance, if you only want to allow one type of file, you could whitelist only its file extension. In the following example, only .html files are let through, and are not converted to a text file:

$handle->allowed   = array('html');
$handle->forbidden = array();
$handle->no_script = false;

In the end, it is your responsibility to make sure the correct files are uploaded. But more importantly, it is your responsibility to serve the uploaded files correctly, for instance by forcing the server to always provide the content-type based on the file extension.

Troubleshooting

If the class doesn't do what you want it to do, you can display the log, in order to see in details what the class does. To obtain the log, just add this line at the end of your code:

echo $handle->log;

Your problem may have been already discussed in the Frequently Asked Questions : http://www.verot.net/php_class_upload_faq.htm

Failing that, you can search in the forums, and ask a question there: http://www.verot.net/php_class_upload_forum.htm. Please don't use Github issues to ask for help.

Processing parameters

Note: all the parameters in this section are reset after each process.

File handling

  • file_new_name_body replaces the name body (default: null)
$handle->file_new_name_body = 'new name';
  • file_name_body_add appends to the name body (default: null)
$handle->file_name_body_add = '_uploaded';
  • file_name_body_pre prepends to the name body (default: null)
$handle->file_name_body_pre = 'thumb_';
  • file_new_name_ext replaces the file extension (default: null)
$handle->file_new_name_ext = 'txt';
  • file_safe_name formats the filename (spaces changed to _, etc...) (default: true)
$handle->file_safe_name = true;
  • file_force_extension forces an extension if there isn't any (default: true)
$handle->file_force_extension = true;
  • file_overwrite sets behaviour if file already exists (default: false)
$handle->file_overwrite = true;
  • file_auto_rename automatically renames file if it already exists (default: true)
$handle->file_auto_rename = true;
  • dir_auto_create automatically creates destination directory if missing (default: true)
$handle->dir_auto_create = true;
  • dir_auto_chmod automatically attempts to chmod the destination directory if not writeable (default: true)
$handle->dir_auto_chmod = true;
  • dir_chmod chmod used when creating directory or if directory not writeable (default: 0777)
$handle->dir_chmod = 0777;
  • file_max_size sets maximum upload size (default: upload_max_filesize from php.ini)
$handle->file_max_size = '1024'; // 1KB
  • mime_check sets if the class check the MIME against the allowed list (default: true)
$handle->mime_check = true;
  • no_script sets if the class turns dangerous scripts into text files (default: true)
$handle->no_script = false;
  • allowed array of allowed mime-types or file extensions (or one string). wildcard accepted, as in image/* (default: check init())
$handle->allowed = array('application/pdf','application/msword', 'image/*');
  • forbidden array of forbidden mime-types or file extensions (or one string). wildcard accepted, as in image/* (default: check init())
$handle->forbidden = array('application/*');

Image handling

  • image_convert if set, image will be converted (possible values : ''|'png'|'webp'|'jpeg'|'gif'|'bmp'; default: '')
$handle->image_convert = 'jpg';
  • image_background_color if set, will forcibly fill transparent areas with the color, in hexadecimal (default: null)
$handle->image_background_color = '#FF00FF';
  • image_default_color fallback color background color for non alpha-transparent output formats, such as JPEG or BMP, in hexadecimal (default: #FFFFFF)
$handle->image_default_color = '#FF00FF';
  • png_compression sets the compression level for PNG images, between 1 (fast but large files) and 9 (slow but smaller files) (default: null (Zlib default))
$handle->png_compression = 9;
  • webp_quality sets the compression quality for WEBP images (default: 85)
$handle->webp_quality = 50;
  • jpeg_quality sets the compression quality for JPEG images (default: 85)
$handle->jpeg_quality = 50;
  • jpeg_size if set to a size in bytes, will approximate jpeg_quality so the output image fits within the size (default: null)
$handle->jpeg_size = 3072;
  • image_interlace if set to true, the image will be saved interlaced (if it is a JPEG, it will be saved as a progressive PEG) (default: false)
$handle->image_interlace = true;

Image checking

The following eight settings can be used to invalidate an upload if the file is an image (note that open_basedir restrictions prevent the use of these settings)

  • image_max_width if set to a dimension in pixels, the upload will be invalid if the image width is greater (default: null)
$handle->image_max_width = 200;
  • image_max_height if set to a dimension in pixels, the upload will be invalid if the image height is greater (default: null)
$handle->image_max_height = 100;
  • image_max_pixels if set to a number of pixels, the upload will be invalid if the image number of pixels is greater (default: null)
$handle->image_max_pixels = 50000;
  • image_max_ratio if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is greater (default: null)
$handle->image_max_ratio = 1.5;
  • image_min_width if set to a dimension in pixels, the upload will be invalid if the image width is lower (default: null)
$handle->image_min_width = 100;
  • image_min_height if set to a dimension in pixels, the upload will be invalid if the image height is lower (default: null)
$handle->image_min_height = 500;
  • image_min_pixels if set to a number of pixels, the upload will be invalid if the image number of pixels is lower (default: null)
$handle->image_min_pixels = 20000;
  • image_min_ratio if set to a aspect ratio (width/height), the upload will be invalid if the image apect ratio is lower (default: null)
$handle->image_min_ratio = 0.5;

Image resizing

  • image_resize determines is an image will be resized (default: false)
$handle->image_resize = true;

The following variables are used only if image_resize == true

  • image_x destination image width (default: 150)
$handle->image_x = 100;
  • image_y destination image height (default: 150)
$handle->image_y = 200;

Use either one of the following

  • image_ratio if true, resize image conserving the original sizes ratio, using image_x AND image_y as max sizes if true (default: false)
$handle->image_ratio = true;
  • image_ratio_crop if true, resize image conserving the original sizes ratio, using image_x AND image_y as max sizes, and cropping excedent to fill the space. setting can also be a string, with one or more from 'TBLR', indicating which side of the image will be kept while cropping (default: false)
$handle->image_ratio_crop = true;
  • image_ratio_fill if true, resize image conserving the original sizes ratio, using image_x AND image_y as max sizes, fitting the image in the space and coloring the remaining space. setting can also be a string, with one or more from 'TBLR', indicating which side of the space the image will be in (default: false)
$handle->image_ratio_fill = true;
  • image_ratio_x if true, resize image, calculating image_x from image_y and conserving the original sizes ratio (default: false)
$handle->image_ratio_x = true;
  • image_ratio_y if true, resize image, calculating image_y from image_x and conserving the original sizes ratio (default: false)
$handle->image_ratio_y = true;
  • image_ratio_pixels if set to a long integer, resize image, calculating image_y and image_x to match a the number of pixels (default: false)
$handle->image_ratio_pixels = 25000;

And eventually prevent enlarging or shrinking images

  • image_no_enlarging cancel resizing if the resized image is bigger than the original image, to prevent enlarging (default: false)
$handle->image_no_enlarging = true;
  • image_no_shrinking cancel resizing if the resized image is smaller than the original image, to prevent shrinking (default: false)
$handle->image_no_shrinking = true;

Image effects

The following image manipulations require GD2+

  • image_brightness if set, corrects the brightness. value between -127 and 127 (default: null)
$handle->image_brightness = 40;
  • image_contrast if set, corrects the contrast. value between -127 and 127 (default: null)
$handle->image_contrast = 50;
  • image_opacity if set, changes the image opacity. value between 0 and 100 (default: null)
$handle->image_opacity = 50;
  • image_tint_color if set, will tint the image with a color, value as hexadecimal #FFFFFF (default: null)
$handle->image_tint_color = '#FF0000';
  • image_overlay_color if set, will add a colored overlay, value as hexadecimal #FFFFFF (default: null)
$handle->image_overlay_color = '#FF0000';
  • image_overlay_opacity used when image_overlay_color is set, determines the opacity (default: 50)
$handle->image_overlay_opacity = 20;
  • image_negative inverts the colors in the image (default: false)
$handle->image_negative = true;
  • image_greyscale transforms an image into greyscale (default: false)
$handle->image_greyscale = true;
  • image_threshold applies a threshold filter. value between -127 and 127 (default: null)
$handle->image_threshold = 20;
  • image_pixelate pixelate an image, value is block size (default: null)
$handle->image_pixelate = 10;
  • image_unsharp applies an unsharp mask, with alpha transparency support (default: false)
$handle->image_unsharp = true;
  • image_unsharp_amount unsharp mask amount, typically 50 - 200 (default: 80)
$handle->image_unsharp_amount = 120;
  • image_unsharp_radius unsharp mask radius, typically 0.5 - 1 (default: 0.5)
$handle->image_unsharp_radius = 1;
  • image_unsharp_threshold unsharp mask threshold, typically 0 - 5 (default: 1)
$handle->image_unsharp_threshold = 0;

Image text

  • image_text creates a text label on the image, value is a string, with eventual replacement tokens (default: null)
$handle->image_text = 'test';
  • image_text_direction text label direction, either 'h' horizontal or 'v' vertical (default: 'h')
$handle->image_text_direction = 'v';
  • image_text_color text color for the text label, in hexadecimal (default: #FFFFFF)
$handle->image_text_color = '#FF0000';
  • image_text_opacity text opacity on the text label, integer between 0 and 100 (default: 100)
$handle->image_text_opacity = 50;
  • image_text_background text label background color, in hexadecimal (default: null)
$handle->image_text_background = '#FFFFFF';
  • image_text_background_opacity text label background opacity, integer between 0 and 100 (default: 100)
$handle->image_text_background_opacity = 50;
  • image_text_font built-in font for the text label, from 1 to 5. 1 is the smallest (default: 5). Value can also be a string, which represents the path to a GDF or TTF font (TrueType).
$handle->image_text_font = 4; // or './font.gdf' or './font.ttf'
  • image_text_size font size for TrueType fonts, in pixels (GD1) or points (GD1) (default: 16) (TrueType fonts only)
$handle->image_text_size = 24;
  • image_text_angle text angle for TrueType fonts, in degrees, with 0 degrees being left-to-right reading text(default: null) (TrueType fonts only)
$handle->image_text_angle = 45;
  • image_text_x absolute text label position, in pixels from the left border. can be negative (default: null)
$handle->image_text_x = 5;
  • image_text_y absolute text label position, in pixels from the top border. can be negative (default: null)
$handle->image_text_y = 5;
  • image_text_position text label position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)
$handle->image_text_position = 'LR';
  • image_text_padding text label padding, in pixels. can be overridden by image_text_padding_x and image_text_padding_y (default: 0)
$handle->image_text_padding = 5;
  • image_text_padding_x text label horizontal padding (default: null)
$handle->image_text_padding_x = 2;
  • image_text_padding_y text label vertical padding (default: null)
$handle->image_text_padding_y = 10;
  • image_text_alignment text alignment when text has multiple lines, either 'L', 'C' or 'R' (default: 'C') (GD fonts only)
$handle->image_text_alignment = 'R';
  • image_text_line_spacing space between lines in pixels, when text has multiple lines (default: 0) (GD fonts only)
$handle->image_text_line_spacing = 3;

Image transformations

  • image_auto_rotate automatically rotates the image according to EXIF data (JPEG only) (default: true, applies even if there is no image manipulations)
$handle->image_auto_rotate = false;
  • image_flip flips image, wither 'h' horizontal or 'v' vertical (default: null)
$handle->image_flip = 'h';
  • image_rotate rotates image. Possible values are 90, 180 and 270 (default: null)
$handle->image_rotate = 90;
  • image_crop crops image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
$handle->image_crop = array(50,40,30,20); OR '-20 20%'...
  • image_precrop crops image, before an eventual resizing. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
$handle->image_precrop = array(50,40,30,20); OR '-20 20%'...

Image borders

  • image_bevel adds a bevel border to the image. value is thickness in pixels (default: null)
$handle->image_bevel = 20;
  • image_bevel_color1 top and left bevel color, in hexadecimal (default: #FFFFFF)
$handle->image_bevel_color1 = '#FFFFFF';
  • image_bevel_color2 bottom and right bevel color, in hexadecimal (default: #000000)
$handle->image_bevel_color2 = '#000000';
  • image_border adds a unicolor border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
$handle->image_border = '3px'; OR '-20 20%' OR array(3,2)...
  • image_border_color border color, in hexadecimal (default: #FFFFFF)
$handle->image_border_color = '#FFFFFF';
  • image_border_opacity border opacity, integer between 0 and 100 (default: 100)
$handle->image_border_opacity = 50;
  • image_border_transparent adds a fading-to-transparent border to the image. accepts 4, 2 or 1 values as 'T R B L' or 'TB LR' or 'TBLR'. dimension can be 20, or 20px or 20% (default: null)
$handle->image_border_transparent = '3px'; OR '-20 20%' OR array(3,2)...
  • image_frame type of frame: 1=flat 2=crossed (default: null)
$handle->image_frame = 2;
  • image_frame_colors list of hex colors, in an array or a space separated string (default: '#FFFFFF #999999 #666666 #000000')
$handle->image_frame_colors = array('#999999',  '#FF0000', '#666666', '#333333', '#000000');
  • image_frame_opacity frame opacity, integer between 0 and 100 (default: 100)
$handle->image_frame_opacity = 50;

Image watermark

  • image_watermark adds a watermark on the image, value is a local filename. accepted files are GIF, JPG, BMP, WEBP, PNG and PNG alpha (default: null)
$handle->image_watermark = 'watermark.png';
  • image_watermark_x absolute watermark position, in pixels from the left border. can be negative (default: null)
$handle->image_watermark_x = 5;
  • image_watermark_y absolute watermark position, in pixels from the top border. can be negative (default: null)
$handle->image_watermark_y = 5;
  • image_watermark_position watermark position withing the image, a combination of one or two from 'TBLR': top, bottom, left, right (default: null)
$handle->image_watermark_position = 'LR';
  • image_watermark_no_zoom_in prevents the watermark to be resized up if it is smaller than the image (default: true)
$handle->image_watermark_no_zoom_in = false;
  • image_watermark_no_zoom_out prevents the watermark to be resized down if it is bigger than the image (default: false)
$handle->image_watermark_no_zoom_out = true;

Image reflections

  • image_reflection_height if set, a reflection will be added. Format is either in pixels or percentage, such as 40, '40', '40px' or '40%' (default: null)
$handle->image_reflection_height = '25%';
  • image_reflection_space space in pixels between the source image and the reflection, can be negative (default: null)
$handle->image_reflection_space = 3;
  • image_reflection_color reflection background color, in hexadecimal. Now deprecated in favor of image_default_color (default: #FFFFFF)
$handle->image_default_color = '#000000';
  • image_reflection_opacity opacity level at which the reflection starts, integer between 0 and 100 (default: 60)
$handle->image_reflection_opacity = 60;

Values that can be read before calling process()

  • file_src_name Source file name
  • file_src_name_body Source file name body
  • file_src_name_ext Source file extension
  • file_src_pathname Source file complete path and name
  • file_src_mime Source file mime type
  • file_src_size Source file size in bytes
  • file_src_error Upload error code
  • file_is_image Boolean flag, true if the file is a supported image type

If the file is a supported image type (and open_basedir restrictions allow it)

  • image_src_x Source file width in pixels
  • image_src_y Source file height in pixels
  • image_src_pixels Source file number of pixels
  • image_src_type Source file type (png, webp, jpg, gif or bmp)
  • image_src_bits Source file color depth

Values that can be read after calling process()

  • file_dst_path Destination file path
  • file_dst_name_body Destination file name body
  • file_dst_name_ext Destination file extension
  • file_dst_name Destination file name
  • file_dst_pathname Destination file complete path and name

If the file is a supported image type

  • image_dst_type Destination file type (png, webp, jpg, gif or bmp)
  • image_dst_x Destination file width
  • image_dst_y Destination file height

Requirements

Most of the image operations require GD. GD2 is greatly recommended

Version 1.x supports PHP 4, 5 and 7, but is not namespaced. Use it if you need support for PHP <5.3

Version 2.x supports PHP 5.3+, PHP 7 and PHP 8.

class.upload.php's People

Contributors

codelingobot avatar cyberwani avatar emretulek avatar eom avatar fevangelou avatar halillusion avatar lukacat10 avatar mad182 avatar peterdd avatar seb33300 avatar verot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

class.upload.php's Issues

processed flag

comments written "Flag set after calling a process". but why the flag is active even before the call to the process itself?
if ($handle->processed) $ResultImage = $handle->process();

how to crop image and resize

--------- To RU
Привет! отличный скрипт!
Подскажи пожалуйста, как решить мою проблему
я использую скрипт http://odyniec.net/projects/imgareaselect/
как использовать параметры которые выдает этот плагин, чтобы сделать кроп картинки с помощью твоего плагина?
какому параметру в Upload() передавать координаты (X1: Width: Y1: Height: X2: Y2:) новой картинки?
Заранее спасибо за помощь!
--------- To EN
Hello! a great script !
Please tell me how to solve my problem
I use a script http://odyniec.net/projects/imgareaselect/
how to use the options that gives this plugin to make crop pictures using your plugin ?
what parameter in the Upload() to transmit the coordinates (X1: Width: Y1: Height: X2: Y2 :) a new picture ?
Thank you in advance for your cooperation!

Require dev-master

Firstly we want to congrats you for this awesome feature.
I personally have used this class for a long years ago. Thank you.

Hello, we use this class in our project SuitUp PHP Framework.
We got an error while try to install dependencies with composer when it is in dev-master. The point is that you recommend us to use as dev-master.

So, do have too much difference between dev-master and 0.33 release?

How to upload images with details of images.

I try to upload images to server.

When i download images from server it's not have details of images like a iso speed, exif,date created, date modify, camera marker,camera model like that.

Thank you.

PHP 7 compatibility

Line 2504: PHP 4 constructors are now deprecated
function upload($file, $lang = 'en_GB')
{
}

Allowed memory size exhausted

Soo my problem is this - i was using version .33dev and all worked fine except i run into image orientation problem, soo i looked for posible solutions and found that version .33 has built in image_auto_rotate soo i was really happy, but when im using the new version im runing into the problem, that wasnt before - if i upload big images ~4Mb i have fattal error: Allowed memory size exhausted, i have post limit 64Mb, file upload limit 30Mb and memory limit 128Mb, soo im baffled what is wrong. Can you please help me?

Can't upload without setting "action" on form

when using $_SERVER['REQUEST_METHOD'] == 'POST' to handle my POST requests I simply can't instantiate a new object but I can grab my $_FILES normally (I thought thats basically what it needs to make a new object) why is that?

image upload using FTP connection

image upload using FTP connection it's possible?
my hosting server has 2mb upload limit, I could create a script to send the picture, use the class_upload to resize, use the resized image and erase the big picture?
What is the shipping method that uses class_upload?

Sorry for bad English

Chnage The Name of File Uploaded On Class.upload.php

Hiii ,
First , I would Thank you For the Great Class 👍 , Second , I want To know Ho to change The name Of the File , I won't To fix the first name . and I want to change _1 I won't it ... Please Excuse me And Thank u Again

Directory removal

I want to suggest to add a parameter, you may be interested
Before you perform
$Handle->clean();

2 parameters:

$Handle->directory_removal_status = TRUE;
$Handle->directory_removal = '/dir1/dir2/dir3/';

For example, we have a file is:
'Uploads/foto/dir1/dir2/dir3/file.jpg'

Delete the file:
$Handle->clean ();

check:
directory removal and file path to compliance

'/dir1/dir2/dir3/' == 'uploads/foto**/dir1/dir2/dir3/**file.jpg'
And remove directory:
uploads/foto/dir1/dir2/dir3
uploads/foto/dir1/dir2
uploads/foto/dir1

If the bottom is no other directories and files

why $handle->image_convert = 'png' not work

why $handle->image_convert = 'png' not work
img upload success,but jpg not convert png
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
date
dba
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mhash
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

Returns original file extension

Hi verot

$img_upload = new upload($_FILES['doska_img']);
$img_file_name = "doska_img".date("Ymdhis");
if ($img_upload->uploaded) {
  $img_upload->file_new_name_body   = $img_file_name;
  $img_upload->image_resize         = true;
  $img_upload->image_x              = 435;
  $img_upload->image_y              = 280;
  $img_upload->image_convert        = 'png';
  $img_upload->process($az_cms_file_upload_folder);
  if ($img_upload->processed) {
    $img_upload->clean();
  } else {
    echo 'error : ' . $img_upload->error;
  }
}
echo $img_upload->file_dst_ext == 'jpg'; //true

preg_replace will be deprecated in php from php 5.5

Hi there,

My webhost is not supporting older versions than 5.6 because of safety issues. The preg_replace function will be deprecated from php 5.5 and on so I can't use this upload class anymore!

It is possible for you to rewrite the upload class to make it compatible with php versions > 5.5? So all the calls for preg_replace need to be reworked to preg_replace_callback.

Looking forward to your reaction.

Regards,

Crispijn, Amsterdam

When posting zip file script doesn't work

When i try to upload zip file or any file that is above 1.5 mb then the code below this line doesn't execute

require ('../library/verot/class.upload.php');

   $handle = new upload($_FILES['shareFile']);
   if ($handle->uploaded)
   { echo "script working"; exit;

but above example doesn't echo anything what could be the reason because no error is generated in the php

composer not working proberly

Hi;
Nice class no doubt! But would be nice if you got it working with the autoloader featured by composer, right now i got to load this manual.

Upload multiple images

I noticed that the object need to be initialized using "new Upload($_FILES["file"]);". However, if I upload multiple files in a single request, how can I process every one of them? If I use following code, only the first image got processed.

$foo = new Upload($_FILES["file"]);
if ($foo->uploaded) {
  $foo->file_new_name_body = "test";
  $foo->image_resize = true;
  $foo->image_convert = png;
  $foo->image_y = 300;
  $foo->image_ratio_y = true;
  $foo->Process('img/');
  if ($foo->processed) {
    echo 'original image copied';
  } else {
    echo 'error : ' . $foo->error;
  }
} else echo 'error : ' . $foo->error;

csv saves a txt

HI i need to upload csv files but when i do i only get a txt file i know it will still work but when i try to delete the file it never does as it doesn't exist as csv but txt.

FILE_MAX_SIZE Bug

Hello
I will upload the problem I think is a bug
When I upload a large file size , error is displayed correctly but if I view the source code on the same page with me, and I will refresh the view source page , file be uploaded

by google translate

My Yii 1.1 Upload Action code:

public function actionUpload($upload = "image") {
        $destPath = Yii::getPathOfAlias('webroot.uploads');
        $thubms = Yii::getPathOfAlias('webroot.uploads.thumbs');
        $errors = array();
        if (isset($_FILES['img'])) {
            Yii::import('ext.upload.Upload');
            $Upload = new Upload((isset($_FILES['img']) ? $_FILES['img'] : null), 'fa_IR');
            $Upload->no_script = false;
            $Upload->allowed = array('image/*');
            $Upload->mime_check = true;
            $Upload->image_resize = true;
            $Upload->file_max_size = '3145728'; # 3MB
            $Upload->image_x = 800;
            $Upload->image_y = 800;
            $Upload->image_interlace = true;
            $Upload->image_ratio = true;

            $newName = md5(microtime() . $Upload->file_src_name);
            $destName = '';
// verify if was uploaded
            if ($Upload->uploaded) {
                $Upload->file_new_name_body = $newName;
                $Upload->process($destPath);

                // if was processed
                if ($Upload->processed) {
                    $destName = $Upload->file_dst_name;
                    $destPathname = $Upload->file_dst_pathname;
                    /* creating thumbnail uploaded image */
                    $Upload->image_resize = true;
                    $Upload->image_x = 600;
                    $Upload->image_y = 600;
                    $Upload->image_ratio = true;
                    $Upload->file_new_name_body = $newName;
                    $Upload->process($thubms);

                    if ($Upload->processed) {
                        $destName = $Upload->file_dst_name;
                        echo Yii::app()->createAbsoluteUrl('uploads/thumbs/' . $destName);
                    } else {
                        print "error";
                    }
                } else {
                    echo "<pre dir='ltr'>error: " . $Upload->error . "</pre>";
                }
            } else {
                echo 'error';
            }
        }
        $this->render('_UploadForm');
    }

Error file_max_size and mime_check

Hi, I am testing the class 0.33dev with this settings:

if ($handle->uploaded) {
    $handle->file_max_size = '1000000'; // 1MB
    $handle->mime_check = true;
    $handle->allowed = array('image/*');
        ....

but I can upload others files types (.pdf, .xlsx) and sizes more than 1MB

Thanks a lot

system information
- class version           : 0.33dev
- operating system        : Linux
- PHP version             : 5.3.29
- GD version              : 2.1.0
- supported image types   : png jpg gif bmp
- open_basedir            : no restriction
- upload_max_filesize     : 2M (2097152 bytes)
- language                : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
    Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
    MIME type detected as application/pdf; charset=binary by UNIX file() command
- MIME validated as application/pdf
source variables
- You can use all these before calling process()
    file_src_name         : 215_MyF-InformeMensual-Feb15.pdf
    file_src_name_body    : 215_MyF-InformeMensual-Feb15
    file_src_name_ext     : pdf
    file_src_pathname     : /tmp/phpCe3a64
    file_src_mime         : application/pdf
    file_src_size         : 1899696 (max= 2097152)
    file_src_error        : 0
process file to tmp/
- error: File too big. : 1899696 > 1000000
process file to tmp/
- file size OK
- file mime OK : application/pdf
- file name safe format
- destination variables
    file_dst_path         : tmp/
    file_dst_name_body    : 215_MyF-InformeMensual-Feb15
    file_dst_name_ext     : pdf
- checking for auto_rename
- destination file details
    file_dst_name         : 215_MyF-InformeMensual-Feb15.pdf
    file_dst_pathname     : tmp/215_MyF-InformeMensual-Feb15.pdf
- 215_MyF-InformeMensual-Feb15.pdf doesn't exist already
- no image processing wanted
- process OK
cleanup
- delete temp file /tmp/phpCe3a64

File Type Validation with File Extension

@verot
Add support for file type validation with file extension.

Currently, I am doing like this.

$file_types = array(
    'doc',
    'docx',
    'txt',
    'xls',
    'xlsx',
    'csv',
    'jpg',
    'jpeg',
    'png'
);
$handle = new Upload($file);
if ($handle->uploaded) {
    $file_types_mime = array();
    foreach( $file_types as $file_type ){
        $file_types_mime[] = $handle->mime_types[$file_type];
    }
    $handle->allowed = $file_types_mime;
}

Cannot End Filename In Variable

This issue occurs when you try to save a filename ending in a variable.

The following does not work:

$handle->file_new_name_body = "img_{$var}";

But this does work:

$handle->file_new_name_body = "img_{$var}_"; // <-- note the underscore

In the first instance, the class tries to rename the filename by appending an integer suffix; _1, _2 and so on, between the supplied filename and the file extension. In the above example, if the value of $var = 'test'; the resulting filename will be img_test_1.jpg

If I set the option:

$handle->file_auto_rename = false;

then the file is not saved at all.

thumbnails not processed when files are larger (> 2mb)

Love the class, but although the original image is processed successfully, the resized thumbnail is not, if the original image is over 2mb. Smaller images of 500kb or so, process the thumbnail successfully.

<?php

if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'xhr') {

    // ---------- XMLHttpRequest UPLOAD ----------
    // we first check if it is a XMLHttpRequest call
    if (isset($_SERVER['HTTP_X_FILE_NAME']) && isset($_SERVER['CONTENT_LENGTH'])) {

        // we create an instance of the class, feeding in the name of the file
        // sent via a XMLHttpRequest request, prefixed with 'php:'
        $handle = new Upload('php:'.$_SERVER['HTTP_X_FILE_NAME']);

    } else {
        // we create an instance of the class, giving as argument the PHP object
        // corresponding to the file field from the form
        // This is the fallback, using the standard way
        $handle = new Upload($_FILES['my_field']);
    }

    // then we check if the file has been uploaded properly
    // in its *temporary* location in the server (often, it is /tmp)
    if ($handle->uploaded) {
        //$timestamp = date("ymd-His")."_";//uncomment to add timestamp to file name

        //$handle->file_name_body_pre = $timestamp;
        $handle->Process($dir_dest);
        // yes, the file is on the server
        // now, we start the upload 'process'. That is, to copy the uploaded file
        // from its temporary location to the wanted location
        // It could be something like $handle->Process('/home/www/my_uploads/');

        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !
            echo '<p class="result">';
            echo '  <b>Photo uploaded successfully.</b><br />';
            echo '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
            echo ' ('.human_filesize(filesize($handle->file_dst_pathname)).')';
            echo '</p>';
            echo('<img src="'.$handle->file_dst_pathname.'" class="img-responsive">');

        } else {
            // one error occured
            echo '<p class="result">';
            echo '  <b>File not uploaded to the wanted location</b><br />';
            echo '  Error: ' . $handle->error;
            echo '</p>';
        }

        //added this... do some resizing:
        $handle->image_resize         = true;
        $handle->image_x              = 300;
        $handle->image_ratio_y        = true;
        $handle->file_name_body_add = '_thumb';

        $handle->Process($dir_dest);
        //and then create the thumb
        if ($handle->processed) {
            // everything was fine !
            echo '<p class="result">';
            echo '  <b>Thumbnail created successfully.</b><br />';
            //echo '  File: <a href="'.$dir_pics.'/' . $handle->file_dst_name . '">' . $handle->file_dst_name . '</a>';
            //echo ' ('.human_filesize(filesize($handle->file_dst_pathname)).')';
            echo '</p>';
        } else {
            // one error occured
            echo '<p class="result">';
            echo '  <b>Unable to create thumbnail.</b> Please contact [email protected]<br />';
            echo '  Error: ' . $handle->error . '';
            echo '</p>';
        }
        // we delete the temporary files
        $handle-> Clean();

    } else {
        // if we're here, the upload file failed for some reasons
        // i.e. the server didn't receive the file
        echo '<p class="result">';
        echo '  <b>File not uploaded on the server</b><br />';
        echo '  Error: ' . $handle->error . '';
        echo '</p>';
    }
}

if (isset($handle)) {
    //echo '<pre>';
    //echo($handle->log);
    //echo '</pre>';
}

function human_filesize($bytes, $decimals = 1) {
    $size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
    $factor = floor((strlen($bytes) - 1) / 3);
    return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
?>

Form is here:
http://photobr.org/resizer/upload_form.php

Listing of files uploaded is here:
http://photobr.org/resizer/uploads/

No errors are thrown.
Only one old error in the logs:
[31-Aug-2015 02:32:48 UTC] PHP Notice: Undefined variable: timestamp in /home/retinacanadaftp/public_html/photobr.org/resizer/oad.phuplp on line 57

array_key_exists() expects parameter 2 to be array

Hi,
I'm implementing a class in a news toy system.
My system is structured as seguite way: A Model class, extends the class.upload.php and a Controller class I implement the Model.
It is my model:

UploadFile class extends upload {
   
     public function __construct () {
         $this->file_new_name_body = md5 (uniqid () . date ('dmaHis'));
         $this->file_auto_rename;
     }
    
}

And my Controller:

$uploadImage = new UploadFile ($_FILES['img_destaque']);
         $uploadImage-> process (DIR . 'images /');
         $imageName = '';

         if ($uploadImage->processed) {
             $imageName = $uploadImage->file_dst_name;
         } Else {
             $otherData ['errorImage'] = $uploadImage-> error;
         }

The error that returns me is:
array_key_exists () expects parameter 2 to be array, null given in /var/www/html/simplecms/vendor/verot/class.upload.php/src/class.upload.php on line 2598

What is wrong?

Save thumb and big

tell me how to best save the downloaded image in two versions: small and big. Now I just call twice to obtain the image, but the process takes a relatively long time.

function GetImage($s){  
        $handle = new upload($_FILES['image'], 'ru_RU');
        if ($handle->uploaded) {            
            $handle->image_x              = $s;
            $handle->image_y              = $s;

            if ($handle->processed) {
                //echo 'image resized';
                return $handle->process();
                $handle->clean();
            } else {
                echo'image error : ' . $handle->error;
            }
        }
    }

Call:

$Item["imagethumb"] = GetImage(100);
$Item["imagebig"] = GetImage(1024);

Line number 2324: you missed a slash

Line number 2324: you missed a slash ('/') in-front of 'extras/magic'
Not sure about other environment but with XAMPP it tries to look for the magic_file in (C:\xampp\phpextras\magic)
So, it prints:
E_WARNING - finfo_open(C:\xampp\phpextras\magic): failed to open stream: No such file or directory in file C:\xampp\htdocs\www\lib\class.upload.php on line 2337

It automatically rotates some images

This is my code -

foreach ($images as $image)
{
    $handle = new upload($image);
    if ($handle->uploaded)
    {
        $handle->file_new_name_body   = 'image_resized';
        $handle->image_resize         = true;
        $handle->image_x              = 1170;
        $handle->image_ratio_y        = true;
        $handle->process('/images/web_launch/processed/');
        if($handle->processed)
        {
            echo 'image resized<br>';
            // $handle->clean();
        }
        else
        {
            echo 'error : ' . $handle->error."<br>";
        }
    }
}

The conversion and compression is working fine but it automatically rotates some images 90 degrees anti-clock wise .

Animated gifs stopped working in latest version

Hello!

There seems to be a problem with animated gifs on latest version 0.34dev.
When I'm uploading animated gifs, it converts them to static images keeping only the first frame after processing, even when mage_resize is set to false and no other manipulations are set.

Animated gifs are working fine on version 0.33dev and older.

My settings:

$upload = new Upload($_FILES['new-image']);
$upload->file_overwrite = true;
$upload->file_auto_rename = false;
$upload->mime_check = true;
$upload->no_script = true;
$upload->file_max_size = '20M';
$upload->allowed = ['image/*'];
$upload->image_resize = false;

PHP version: 7.0.11

It happens with any animated gif image I tried, e.g. https://gif-avatars.com/img/150x150/happy-cat.gif

IOS direct upload orientation?

Still having trouble with pictures shot on IOS10 with iPhone6 in portrait mode. After upload without first editing photo shows up as landscape. Should this be working properly in latest release?

PCRE issue?

recently upgraded MAMP (v 3.3) using php v 5.4.42

PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2899
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2939
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2966
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 2993
PHP Warning: preg_match(): Compilation failed: invalid range in character class at offset 7 in .../class.upload_0.32.php on line 3011

escaping the hyphens should fix this.

example from line #2899

  • if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {
  • if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {

MIME types for office documents now working

I've been trying to upload some excel files and I've set up mime types like this:
$handle->allowed = array('application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', 'application/vnd.ms-excel.addin.macroEnabled.12');

Using all the excel mime types I've found, but I still get "Incorrect type of file" on every .xlsx file while .xls uploads without a problem.

(Same problem with .docx, .pptx)

When I try to get file mime type with ->file_src_mime i get either "application/zip" or "application/x-empty"

Warning: preg_match(): Compilation failed: invalid range in character class at offset 7

Hi verot,

first I would say thank you for your beautiful upload class and your work.

Nowdays, when I use your class I become 5 warnings with the same issue, because of my new PHP Version 5.6.

Warning: preg_match(): Compilation failed: invalid range in character class at offset 7
if (preg_match("/^([.-\w]+)/([.-\w]+)(.*)$/i", $this->file_src_mime)) {

I'm not a "regex-expert", I found on stackoverflow that the dash must be escaped because of the PHP Version 5.6. " -". Is this correct?

Thanks for your answer and greetings from Berlin,

Max

File size Explained

First let me say great code, helped me a lot and saved lots of time.
I'm trying to implement this but having some issues resizing the images. I'm setting the limit for the file size to 4MB, however when uploaded i wanted to resize the Pic to around 500 to 600kb so that it is faster on loading an image gallery and keeps great viewing dimensions(large format so when you hover on the image it will enlarge to show the full image). this is my setup, i have been playing with this and can't get it right, the image keeps resizing to like a thumbnail size.
What am i doing wrong here?

thanks for the help`

$handle->file_new_name_body = $fileNameNew;
$handle->file_safe_name = true;
$handle->file_overwrite = true;
$handle->dir_auto_create = true;
$handle->file_max_size = '4194304'; // 4MB
$handle->allowed = array('image/*');
$handle->image_convert = $defaultExt;
//$handle->image_resize = true;
$handle->image_ratio = true;
//$handle->image_ratio_x = true;
//$handle->image_x = 1500;
//$handle->image_ratio_no_zoom_in = true;
$handle->image_ratio_pixels = 25000;

Cropping not working

I have a PHP page that uses php_class_upload. All works well except that I'm having issues with cropping.

I pass the Left, Top, Right, and Bottom values all values come across (no issues here)

Log:

[27-Aug-2015 19:31:40 America/Chicago] top 52 ,right 239 , bottom 172 ,left 119

What I'm trying to accomplish is resize the image then crop it.

I have set up the following code for php_class_upload:

 $foo->file_new_name_body =  $new_image_name;
 $foo->image_resize = true;
 $foo->image_x = $_width;
 $foo->image_ratio_y = true;
 $foo->image_convert = png;
 $foo->Process( $structure);
 $foo->image_rotate = $rotate;      
 $foo->image_crop = array($top ,$right,$bottom,$left); //  'T R B L'.

The image uploads okay and its resizes correctly. however the cropping is not applied.
(just a note, I want the crop after the resize)

I also tried to hard code the vales like below
$foo->image_crop = '5 40 10% -20';
$foo->image_crop = array( 0,100,100,0);
$foo->image_crop = '0,100,100,0';

I think my issue is how I'm setting up the array but I'm at a point where I need help. Any help at all would be greatly appreciated.

When resize = true, the upload is too slow

I've implemented the script, but when the resize option is true, the upload seems to be too slow to finish, even in localhost. I'm using wamp server with gd2 activated. There's any solution for this?

Url image server

Add the ability to process images already uploaded to the server.
Example:
$handle = new upload( 'url image server', 'fr_FR', FALSE);
FALSE indicates that it is not $ _FILE and the image is already located on the server

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.