Verot class upload php

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

newerton/verot-upload

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Package of VEROT’s Upload Class

This package is simply a copy of Verot’s PHP Upload class.

An example will be more useful than any blurb I can write :

$foo = new Upload($_FILES['form_field']); if ($foo->uploaded) < // save uploaded image with no changes $foo->Process('/home/user/files/'); if ($foo->processed) < echo 'original image copied'; > else < echo 'error : ' . $foo->error; > // save uploaded image with a new name $foo->file_new_name_body = 'foo'; $foo->Process('/home/user/files/'); if ($foo->processed) < echo 'image renamed "foo" copied'; > else < echo 'error : ' . $foo->error; > // save uploaded image with a new name, // resized to 100px wide $foo->file_new_name_body = 'image_resized'; $foo->image_resize = true; $foo->image_convert = gif; $foo->image_x = 100; $foo->image_ratio_y = true; $foo->Process('/home/user/files/'); if ($foo->processed) < echo 'image renamed, resized x=100 and converted to GIF'; $foo->Clean(); > else < echo 'error : ' . $foo->error; > >

What does it actually do in this example?

This example uses a file uploaded via a form. With this single file, it will :

  • copy the file without any modification
  • copy the file after having changed its name to ‘foo’
  • copy the file, resizing it to x=100, y=auto, converting it to GIF
  • the class constructor upload handles a uploaded file (it can also handle a local file)
  • some optional parameters can be set up to act on the file during the process
  • the process is called with as an argument the destination directory on the server. If some parameters have been set up, the class will rename, resize, convert files and images
  • when the uploaded file is not needed anymore, we can delete it using clean.
  • with one uploaded file, you can do as many copies, convertions, resizing you want.
  • you can resize each image dimension, or both, keeping the image ratio or not.
  • you can choose to resize an image only if it is bigger -or smaller- than the wanted sizes
  • you can manipulate the image in many ways, play with colors, add borders, labels and watermarks.
  • its use is simplistic but powerful
  • you can work on uploaded files or local files, useful for batch processing
  • Flash uploaders are fully supported
  • MIME type detection is very comprehensive
  • more than 60 documented configuration settings
  • a lot of variables are set up during the process. You can retrieve all these values after a process.
  • error messages are understandable, and a variable log allows you to see what the class does.
  • it is translated in more than 25 languages
  • it is already widely used on Internet
  • it is free 🙂

Is it out there on Internet?

The class.upload.php source code has been downloaded well over 100 000 times just in the last three years. It is also a key part of the popular K2 content component for Joomla!, downloaded over 500 000 times, and has been implemented in numerous CMS and frameworks!

class.upload.php is featured on HotScripts. If you like the script, please rate it or write a review for it. You can find it here.

class.upload.php is featured on PHP Classes. If you like the script, please rate it there. You can find it here.

class.upload.php is featured on Freshmeat. If you like the script, please rate it there. You can find it here.

Источник

verot.net

class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.

class.upload.php

upload.jpg

This PHP script uploads files and manipulates images very easily. The perfect script to generate thumbnails or create a photo gallery! It can convert, resize and work on uploaded images in many ways, apply effects, add labels, watermarks and reflections and other image editing features. You can use it for files uploaded through an HTML form, a Flash uploader, XMLHttpRequest or on local files. It uses the GD library. This script is released under the GPL Version 2, and has been downloaded a few million times in the last few years! If your project is not GPL, commercial licenses are available.

Please note that the lastest code and documentation is now on GitHub!

What is it?

An example will be more useful than any blurb I can write :

namespace Verot\Upload; $foo = new Upload($_FILES['form_field']); if ($foo->uploaded) < // save uploaded image with no changes $foo->process('/home/user/files/'); if ($foo->processed) < echo 'original image copied'; >else < echo 'error : ' . $foo->error; > // save uploaded image with a new name $foo->file_new_name_body = 'foo'; $foo->process('/home/user/files/'); if ($foo->processed) < echo 'image renamed "foo" copied'; >else < echo 'error : ' . $foo->error; > // save uploaded image with a new name, // resized to 100px wide $foo->file_new_name_body = 'image_resized'; $foo->image_resize = true; $foo->image_convert = 'gif'; $foo->image_x = 100; $foo->image_ratio_y = true; $foo->process('/home/user/files/'); if ($foo->processed) < echo 'image renamed, resized x=100 and converted to GIF'; $foo->clean(); > else < echo 'error : ' . $foo->error; > >

What does it actually do in this example?

This example uses a file uploaded via a form. With this single file, it will :

  • copy the file without any modification
  • copy the file after having changed its name to ‘foo’
  • copy the file, resizing it to x=100, y=auto, converting it to GIF

How does it work?

  • the class constructor upload handles a uploaded file (it can also handle a local file)
  • some optional parameters can be set up to act on the file during the process
  • the process is called with as an argument the destination directory on the server. If some parameters have been set up, the class will rename, resize, convert files and images
  • when the uploaded file is not needed anymore, we can delete it using clean.

Why use this class?

  • with one uploaded file, you can do as many copies, convertions, resizing you want.
  • you can resize each image dimension, or both, keeping the image ratio or not.
  • you can choose to resize an image only if it is bigger -or smaller- than the wanted sizes
  • you can manipulate the image in many ways, play with colors, add borders, labels and watermarks.
  • its use is simplistic but powerful
  • you can work on uploaded files or local files, useful for batch processing
  • XMLHttpRequest and Flash uploads are fully supported
  • MIME type detection is very comprehensive
  • more than 60 documented configuration settings
  • a lot of variables are set up during the process. You can retrieve all these values after a process.
  • error messages are understandable, and a variable log allows you to see what the class does.
  • it is translated in more than 25 languages
  • it is already widely used on Internet
  • it is free 🙂

Is it out there on Internet?

The class.upload.php source code has been downloaded well over 1 000 000 times over the last ten years. It is also a key part of the popular K2 content component for Joomla!, downloaded over 2 000 000 times, and has been implemented in numerous CMS and frameworks!

Источник

Читайте также:  Java static блок инициализации
Оцените статью