Create a lighter shade of a hex color:
Create a lighter shade of a hex color
<?
function hexLighter($hex,$factor = 30)
{
$new_hex = '';...
Thumbnail function
<?php
function make_thumb($imagefile, $new_w=75, $new_h=75)
{
// get source image info.
$img_data=getimagesize($imagefile);
$src_w=$img_data;
$src_h=$img_data;
// get source image
$src_img=ImageCreateFromPNG($imagefile) or die ("Cannot open source");
// create...
Write Text to the Image
<?php
//=========== change the text to display in the image
//$text = 'mydomain.com';
//$imgfile="smp.jpg";
$font = 'arial.ttf';
$ext=substr($imgfile,-3);
$ext=strtolower($ext);
if($ext=="jpg" || $ext=="jpe") $im=@imagecreatefromjpeg("$imgfile");
elseif ($ext=="gif") $im=@imagecreatefromgif("$imgfile");
else {print "Unknown image format"; exit;}
...
PHP Basics
What Does php stand for?
PHP: Hypertext Preprocessor
php tag
<?php
/ code goes here ?
?>
Comments in php
/ comments go here /
// or comments go here
Variables in PHP
&Variale_Name
-...
PHP Calendar functions
Function
Reference
cal_days_in_month()
Returns the number of days in a month for a specified year and calendar
cal_from_jd()
Converts a Julian day count into a date of a specified...
PHP FTP functions
Function
Description
ftp_alloc()
Allocates space for a file to be uploaded to the FTP server
ftp_cdup()
Changes the current directory to the parent directory on the FTP server
ftp_chdir()
Changes the...
PHP File functions
Function
Description
basename()
Returns the filename component of a path
chgrp()
Changes the file group
chmod()
Changes the file mode
chown()
Changes the file owner
clearstatcache()
Clears the file status cache
copy()
Copies a file
delete()
See unlink() or...
PHP Constants and predefined vars
Constant
Description
bool define(string name, mixed value, )
define constant
mixed constant(string name)
show const value
bool defined(string name)
check if is definded
array get_defined_constants(bool categ.)
show all defined const.
bool function_exists( string function)
check...
PHP Misc functions
Function
Reference
connection_aborted()
Checks whether the client has disconnected
connection_status()
Returns the current connection status
connection_timeout()
Deprecated in PHP 4.0.5. Checks whether the script has timed out
constant()
Returns the value of a...
PHP Error functions
Function
Reference
debug_backtrace()
Generates a backtrace
debug_print_backtrace()
Prints a backtrace
error_get_last()
Returns the last error that occurred
error_log()
Sends an error message to a log, to a file, or to a mail account
error_reporting()
Specifies...