...

View Full Version : PHP bitmap resize: which one is right?



student101
03-13-2010, 10:18 AM
bitmap resize: which one is correct?


switch ($oFile['type']){

// which case below is correct?

case 'image/bmp':
case 'image/imagewbmp':
case 'image/vnd.wap.wbmp':

// which case above is correct?

$oldImage = imagecreatefromwbmp($oFile['tmp_name']);
imagecopyresampled($newImage, $oldImage, 0, 0, 0, 0, $newWidth, $newHeight, $oldWidth, $oldHeight);
imagewbmp($newImage, $sFilePath);
break;

Fou-Lu
03-13-2010, 11:34 PM
This one is: 'image/vnd.wap.wbmp'
Best I know, wbmp is not related to bmp by way of file structure; the wbmp is for a wireless protocol, so I'd presume that its compressed in some fashion.
Bitmap images themselves have an easy file structure. I don't believe that an imagecreatefromwbmp or imagecreatefromstring works on a bitmap image, but you can write you're own handling for it by following the bitmap file format (http://en.wikipedia.org/wiki/BMP_file_format) on the wiki site.

student101
03-13-2010, 11:54 PM
Yes that's what I came to understand,
simpler just to deny that file type for uploads.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum