student101 Posted March 13, 2010 Share Posted March 13, 2010 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; Link to comment Share on other sites More sharing options...
Synook Posted March 13, 2010 Share Posted March 13, 2010 The switch is constructed so that for all of the three cases, the below code would be executed - so there is no "correct" one, per se. For BMPs, image/bmp is commonly used[1]. The other two are for WAP bitmaps[2].Interestingly enough, there is no registered MIME type for the BMP file format[3]. image/vnd.wap.wbmp is registered for WBMP[2], however it is vendor specific (hence vnd)[4]. Link to comment Share on other sites More sharing options...
boen_robot Posted March 13, 2010 Share Posted March 13, 2010 If the extension is BMP, filext on BMP says all of the following: Mime type: image/bmp, image/x-bmp, image/x-bitmap, image/x-xbitmap, image/x-win-bitmap, image/x-windows-bmp, image/ms-bmp, image/x-ms-bmp, application/bmp, application/x-bmp, application/x-win-bitmap In the PHP example on imagecreatefromwbmp, you have "image/vnd.wap.wbmp".I don't think any one of those MIME types is more or less "correct", though I'd choose that last one, only because it actually contains the word "wbmp" in it. If I was doing both BMPs and wBMPs, I may want to know which is which by the MIME type too. Link to comment Share on other sites More sharing options...
student101 Posted March 13, 2010 Author Share Posted March 13, 2010 Thanks for you replies, it seems I need to either write a bitmap resize script or not allow the .BMP extension - the latter being simpler. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.