Ok lets start learning PHP

lionsIT

Member
Mar 26, 2008
23
0
0
Colombo
Lets see how to get the size of a image (width and height)

PHP:
<?php
$filename = "1.jpg";
$size = getimagesize($filename); //return an array of details

echo $size[0].'<br>';//width
echo $size[1].'<br>';//height
echo $size[2].'<br>';//image type constant
echo $size[3].'<br>';// both width and height
echo $size['mime'].'<br>';// mime type - image/jpeg

?>

Remeber to give the correct file path, my image file is on the same directory as my php file.
 

lionsIT

Member
Mar 26, 2008
23
0
0
Colombo
Today we'll look at some nice php string functions

PHP:
<?php

$my_string = "this is My String ElaKiri";

$str = strtolower($my_string); // convert all the letters to lower case
echo $str;
 
$str = strtoupper($my_string); // convert all the letters to Upper case
echo $str; 

$str = ucfirst($my_string); // convert First Character to Upper case
echo $str; // This is My String ElaKiri

$str = ucwords($my_string);// convert First Character of all words Upper case
echo $str; // This Is My String ElaKiri

?>

:)