PHP Tutorials - Tutorial Addendum - Directories, Files and Images

 31 December 18:00   

    



    



    

(Continued from antecedent part...)

    



        



  •     

    imagecolorallocate -- Admeasure a blush for an image

        



  •     



  •     

    imagecolorat -- Get the basis of the blush of a pixel

        



  •     



  •     

    imagecolorexact -- Get the basis of the defined color

        



  •     



  •     

    image new s/reference-and-education/colors-list/' onMouseOver="tip('infobox1')" onMouseOut="untip()"> colors forindex -- Get the colors for an index

        



  •     



  •     

    image colors total -- Acquisition out the amount of colors in an angel s palette

        



  •     



  •     

    imagecolortransparent -- Ascertain a blush as transparent

        



  •     



  •     

    imagecopy -- Archetype allotment of an image

        



  •     



  •     

    imagecopymerge -- Archetype and absorb allotment of an image

        



  •     



  •     

    imagecopyresized -- Archetype and resize allotment of an image

        



  •     



  •     

    imagecreatefromgif -- Make a new angel from book or URL

        



  •     



  •     

    imagecreatefromjpeg -- Make a new angel from book or URL

        



  •     



  •     

    imagecreatefromwbmp -- Make a new angel from book or URL

        



  •     



  •     

    imagedestroy -- Abort an image

        



  •     



  •     

    imagefill -- Flood fill

        



  •     



  •     

    imagefilledarc -- Draw a fractional ambit and ample it

        



  •     



  •     

    imagefilledrectangle -- Draw a abounding rectangle

        



  •     



  •     

    imagefilltoborder -- Flood ample to specific color

        



  •     



  •     

    imagefttext -- Address argument to the angel using fonts using FreeType 2

        



  •     



  •     

    imagegif -- Achievement angel to browser or file

        



  •     



  •     

    imagejpeg -- Achievement angel to browser or file

        



  •     



  •     

    imageline -- Draw a line

        



  •     



  •     

    imageloadfont -- Amount a new font

        



  •     



  •     

    imagepolygon -- Draw a polygon

        



  •     



  •     

    imagerectangle -- Draw a rectangle

        



  •     



  •     

    imagesetpixel -- Set a individual pixel

        



  •     



  •     

    imagestring -- Draw a cord horizontally

        



  •     



  •     

    imagesx -- Get angel width

        



  •     



  •     

    imagesy -- Get angel height

        



  •     



  •     

    imagettftext -- Address argument to the angel using TrueType fonts

        



  •     



  •     

    imagewbmp -- Achievement angel to browser or file

        



  •     



  •     

    jpeg2wbmp -- Catechumen JPEG angel book to WBMP angel file

        



  •     



  •     

    png2wbmp -- Catechumen PNG angel book to WBMP angel file

        



  •     



    



    



    

ShowPhoto.php - Assuming Images in a Directory

    



    

To appearance you how to use functions directories, files, and images, I wrote the afterward sample program:

    

 

    

<?php # PhotoShow.php

    

# Absorb (c) 2003 by Dr. Yang, http://www.yang.com/

    

#

    

#- Get the photo book name

    

$i = intval($_GET[ i ]);

    

$c = 0;

    

$p = "";

    

if ($d = opendir(".")) {

    

while (($f = readdir($d)) != false) {

    

if (preg_match( /.jpg$/ ,$f)) {

    

if ($i==$c) {

    

$p = $f;

    

}

    

$c++;

    

}

    

}

    

closedir($d);

    

}

    

#- Body the page

    

$h = fopen("header.html", "r");

    

$s = fread($h, filesize("header.html"));

    

fclose($h);

    

book "$s
";

    

if (strlen($p)>0) {

    

$i1 = ($i+$c-1) % $c;

    

$i2 = ($i+$c+1) % $c;

    

list($width, $height, $type, $attr) = getimagesize($p);

    

if ($width>700) {

    

$width = $width/2;

    

$height = $height/2;

    

}

    

book "<center><a href="ShowPhoto.php?i=$i1"><=</a>&nbsp;"

    

."<a href="ShowPhoto.php?i=$i2">=></a></center>
"

    

."<center><img src="$p" border="1" width="$width" "

    

."height="$height"></center><br>
"

    

."<center><a href="ShowPhoto.php?i=$i1"><=</a>&nbsp;"

    

."<a href="ShowPhoto.php?i=$i2">=></a></center>
";

    

} abroad {

    

book "<p>Wrong URL. Amuse go aback to the home page.</p>
";

    

}

    



    

$h = fopen("footer.html", "r");

    

$s = fread($h, filesize("footer.html"));

    

fclose($h);

    

book "$s
";

    

?>

    



    



    

Try it out. It s actual simple to use. You can calmly adapt it to accommodated your requirements.

    



    



    

 


Tags: create, files, directories, images, color, browser, image, center, notes, tutorial, tutorials, print

 image, center, width, height, showphoto, print, images, output, files, color, create, directories, browser, , < center, center <, showphoto php, output image, image from, files and, new image, directories files, new image from, image from file, notes directories files, tutorial notes directories, tutorials tutorial notes, php tutorials tutorial,

Share PHP Tutorials - Tutorial Addendum - Directories, Files and Images:
Digg it!   Google Bookmarks   Del.icio.us   Yahoo! MyWeb   Furl  Binklist   Reddit!   Stumble Upon   Technorati   Windows Live   Bookmark

Text link code :
Hyper link code:

Also see ...

Permalink
Article In : Computers & Technology  -  php