WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Upload images restricted by pixel size (Picture width and Picture Height)
Categories : PHP, HTML and PHP, Graphics Click here to Update Your Picture
Marco Luzzi
Date : Aug 11th 2004
Grade : 2 of 5 (graded 2 times)
Viewed : 6120
File : 3975.php
Images : No Images for this code example.
Search : More code by Marco Luzzi
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 


Upload images restricted by pixel size

in this example x <= 200 pixel and y <= 200 pixel

NOTE:
We assume coming from a <form> html page where we have
in input some file as: <input type=file name=image>
[code] 
<?php
$size
= GetImageSize("$image");
$width = $size[0] ;
$height = $size[1] ;
if(
$width>200 || $height>200){
      print
"Error.. image max size is 200x200<br>";
     
?><a href="javascript:history.go(-1)"><- back</a><?
     
exit;
}

$noinput = true;
$path="img"; //put path of dir. we assume is under actual dir. and called img

if($image != none && $image_name != "" && !empty($image_name)) {
   
//print("Percorso locale: $image <BR>\n");
   
print("File name: $image_name <BR>\n");
   print(
"File Dimension: $image_size <BR>\n");
   print(
"File Type: $image_type <BR>\n");
   print(
"<HR>");

   if(
$image!="none" &&
     
copy($image , "$path/$image_name" ) &&
     
unlink($image)){
     
$nofile=false;
      echo
"<center>";
      echo
"<br>File <b>".$image_name."</b> loaded successfully.<br><br>";
      echo
"</center>";
   }else{
      print
"Error.. upload aborted<br>";
     
?><a href="javascript:history.go(-1)"><- back</a><?
     
exit;
   }
}else{
   
$nofile=true;
   print
"... no file to upload.<br>";
}
/*
code by Marco Luzzi - www.byimage.com
*/
?>



Random Image Display
Categories : PHP, Filesystem, Graphics, HTML and PHP
Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
webcam cam view image ispy browser independant
Categories : Graphics, HTML, HTML and PHP, PHP
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
Snipe.Net's Web Design Color Scheme Previewer- Allows uses to input hex codes for their text, background, and link colors, and preview the color scheme with their background image. Example: http://www.snipe.net/tech/snipeschool/hex.php3
Categories : PHP, HTML and PHP, General, Graphics, HTML
PHPixel - output of 1 pixel transparent/colored gif for counters etc.
Categories : PHP, Graphics, HTML and PHP
Barcodes On The Fly With GD
Categories : Ecommerce, Graphics, HTML and PHP, PHP
Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase
Proportional thumbnails
Categories : PHP, HTML and PHP, Graphics
PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics
a function that builds an HTML select list from any mysql table.
Categories : PHP, MySQL, HTML and PHP
Tag content retrieval from websites with preg_match
Categories : PHP, Regexps, Arrays, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables