WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 : img_upload - array img_upload(string 'form field name', string 'image name', string 'destination'); Returns an array with 2 elements. Index 0 contains the string name of the image. Index 1 contains the string path to the image.
Categories : Graphics, PHP Update Picture
Jeremiah Davis
Date : Jul 03rd 1998
Grade : 4 of 5 (graded 1 times)
Viewed : 5511
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Jeremiah Davis
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/*---------------------------------/// img_upload()
///----------------------------------------------*/
function img_upload($form_field,$img_name,$destination_path)
{
if (ereg("\.gif$",$img_name) || ereg("\.jpe?g",$img_name)) /* check to
see if the uploaded file is a valid format */
{
$i = "0"; /* if it is a
valid format check and see if the file name is already used */
$d = dir($destination_path);
while($entry=$d->read())
{
if ($entry == $img_name)
{
$img_name_in_use = "TRUE"; /* if the file
name is used, then set $img_name_in_use to TRUE */
}
++$i;
}

$d->close();
if ($img_name_in_use == "TRUE") /* if the file
name is used, then do this stuff */
{
$new_img_name = date('hms').$img_name; /* give the
file a uniqe name */
$new_img_location = $destination_path.'/'.$new_img_name; /* set the
new location of the file (path/filename.extension) */

copy($form_field,$new_img_location); /* copy the
file from /tmp to new location */

chmod($new_img_location, 0666); /* change the
permisions of the image file */

$img_array = array("$new_img_name","$new_img_location"); /* create an
array to be passed out of the function */

}
else /* if the file
name is used, then do this stuff */
{
$new_img_name = $img_name; /* give the
file a uniqe name */
$new_img_location = $destination_path.'/'.$new_img_name; /* set the new
location of the file (path/filename.extension) */

copy($form_field,$new_img_location); /* copy the
file from /tmp to new location */

chmod($new_img_location, 0666); /* change the
permisions of the image file */

$img_array = array("$new_img_name","$new_img_location"); /* create an
array to be passed out of the function */


}
}
else /* if the file
was not a valid type, then echo this error message */
{
echo '<FONT SIZE=4>'
.'The file you uploaded was of an incorect type, please only upload
.GIF or .JPG files'
.'<BR CLEAR=ALL>'
.'</FONT>'
."Hit your browser's back button to continue"
.'<P>';

}

return($img_array);
}
/*---------------------------------/// img_upload()
///----------------------------------------------*/



PHP Image Compression using GD library
Categories : PHP, Compression, GD image library, Graphics
This is a script that list all image files on a given directory, and displays the thumbnails nicely formated within an HTML table. It also make use of JavScript to open pop up windows when the users want to see the full photo.
Categories : Graphics, PHP, Complete Programs, Java Script
Create images on fly using GD-Image Lib
Categories : PHP, Graphics
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library
Barcodes On The Fly With GD
Categories : Ecommerce, Graphics, HTML and PHP, PHP
Line graphics generation library written in PHP + GD library (spanish comments)
Categories : PHP, Graphics, GD image library
a simple pie-chart in php3 (with gd)
Categories : PHP, Graphics, GD image library, Charts and Graphs
Simple image counter
Categories : PHP, Graphics, Filesystem, Beginner Guides
This is a simple photo gallery that reads the image files from multiple directories, and generates a web page styled with CSS1. It opens single auto window to view and print a given image.
Categories : Graphics, Filesystem, PHP, Complete Programs
This program implements hot link prevention in php. It is useful for webmasters who do not have access to the server at a level where they can control hot linking can still supply some type of hot link prevention for thier site by using php.
Categories : PHP, Filesystem, Graphics, Content Management
Easy slideshow with php. Just place this one file into a subdirectory where jpg files reside. An instant slideshow is yours. MS explorer only.
Categories : PHP, Filesystem, Graphics
CAPTCHA[Image verification]
Categories : PHP, Security, GD image library, Graphics, Sessions
The simple counter with use MySql and gd.
Categories : MySQL, HTTP, Graphics, PHP, Databases
A couple of functions that convert an IP address into its color code and not-color-code. Useful when viewing an apache log with a mysql result grouped by IP
Categories : PHP, Graphics, Databases
How to display any array in several rows and columns of a table. Not just in one column or in alternate rows. This example shows a nice color table generated with PHP, but can be used with any array values(e.g. Database)
Categories : Arrays, PHP, Miscellaneous, Beginner Guides, Graphics