• Index
  •  » PHP
  •  » How to upload and resize images in PHP

#1 2008-05-26 02:52:23

Fuad
Member
RankingRankingRanking
Registered: 2008-01-09
Posts: 98
Expertise

How to upload and resize images in PHP

Hi,

One of the most common practises in PHP coding with GD is to create a thumbnail image of an uploaded file. In this tutorial we will examine an image upload form, look at PHP's file upload system, and use an uploaded image to create a small thumbnail image.

Please note this requires you to use the GD2 library. You can normall allow it by changing your php.ini by removing the ; in front of extension=php_gd2.dll.

PHP's built in system for uploading files allows us to create an HTML form that uses the "file" element. This is a type of HTML input tag that tells a user's web browser to display a file selection dialogue, and to include any selected file with the data sent along with a form.

Code::

<form action="index.html" method="POST" enctype="multipart/form-data"> 
    <input type="hidden" name="MAX_FILE_SIZE" value="200000">"; 
    <input type="file" name="imagefile"> 
    <input type="submit" name="upload" value="Upload Image"> 
</form>

Thanks,
Fuad.

Offline

 
  • Index
  •  » PHP
  •  » How to upload and resize images in PHP

Board footer

OPML feedsRSS feeds



Powered by WWWThreads Forum
© Copyright 2006, WWWThreads