PHP Classes

Explanation..

Recommend this page to a friend!

      BMP Thumbnail  >  All threads  >  Explanation..  >  (Un) Subscribe thread alerts  
Subject:Explanation..
Summary:bmp to thumbnail
Messages:3
Author:Muhammad Sohail Khan
Date:2006-08-15 10:19:52
Update:2006-08-15 12:36:19
 

  1. Explanation..   Reply   Report abuse  
Picture of Muhammad Sohail Khan Muhammad Sohail Khan - 2006-08-15 10:19:52
If ur image file extension is other then .bmp then use the if condition like that.
first check pare extensiion of the image
$ext = explode(".","imagefile");
if ($ext[1]=='bmp' || $ext == 'BMP')
{
$objBmpToJpg = new ConvertBMP2GDClass();
$img = $objBmpToJpg -> imagecreatefrombmp("snake.bmp");
imagepng($img, "test3.png");
}else{
$thumb = new thumbnail("test3.png");
}

enjoy ......
if u find some bugs then plz let me konw....

Thanx..

Muhammad Sohail Khan

  2. Re: Explanation..   Reply   Report abuse  
Picture of Giuseppe Leone Giuseppe Leone - 2006-08-15 11:10:11 - In reply to message 1 from Muhammad Sohail Khan
Hi Muhammuad,
we must consider that a file's name could contains more than one dot, inside !!! This is the right example to retrieve the "real" extension of a file:

<?php
$myFile = "MyName.MyFirstExt.MySecondExt.MyLastExt.txt";
$myExt = explode(".",$myFile);

//This is the real extension
echo $myExt[count($myExt)-1];
?>

Soon,
Giuseppe Leone

P.S.
Sorry for my english ;)

  3. Re: Explanation..   Reply   Report abuse  
Picture of Muhammad Sohail Khan Muhammad Sohail Khan - 2006-08-15 12:36:19 - In reply to message 2 from Giuseppe Leone
Hi Leone,
Thanx for commenting...You are right , we have to check for that..

Once again thanx

Muhammad Sohail Khan