Thumbnail not created for .bmp images

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
sweety
Regular
Posts: 42
Joined: Tue Jul 05, 2005 11:05 am

Thumbnail not created for .bmp images

Post by sweety »

hi all,
I am not able to upload .bmp images properly into my blogs.If it is a very large image then the entire page layout is getting changed.
I checked in my physical folder and found out that thumbnails are not getting created for .bmp images.Why is it so?
for any image "imagename.serendipityThumb.extension" is getting created once we upload images through Add Media.But for .bmp images they are not getting created. I saw in functions_images.inc.php file and found the following code:

Code: Select all

function serendipity_functions_gd($infilename) {
    if (!function_exists('imagecopyresampled')) {
        return false;
    }

    $func = array();
    $inf  = pathinfo(strtolower($infilename));
    switch ($inf['extension']) {
    case 'gif':
        $func['load'] = 'imagecreatefromgif';
        $func['save'] = 'imagegif';
        break;

    case 'jpeg':
    case 'jpg':
    case 'jfif':
        $func['load'] = 'imagecreatefromjpeg';
        $func['save'] = 'imagejpeg';
        break;

    case 'png':
        $func['load'] = 'imagecreatefrompng';
        $func['save'] = 'imagepng';
        break;
there is no case for 'bmp' also in this code:

Code: Select all

function serendipity_guessMime($extension) {
    $mime = '';
    switch (strtolower($extension)) {
        case 'jpg':
        case 'jpeg':
            $mime = 'image/jpeg';
            break;

        case 'aiff':
        case 'aif':
            $mime = 'audio/x-aiff';
            break;

        case 'gif':
            $mime = 'image/gif';
            break;

        case 'bmp':
             $mime='image/bmp';
             break;

        case 'png':
            $mime = 'image/png';
            break;

        case 'pdf':
            $mime = 'application/pdf';
            break;
.......
there is no case for 'bmp'..
do i have to add anything here for thumbnails to be created for .bmp images?
Can anyone please help me in solving my problem?
Thanking you in advance
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thumbnail not created for .bmp images

Post by garvinhicking »

You shouldn't use BMP images in web-context.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sweety
Regular
Posts: 42
Joined: Tue Jul 05, 2005 11:05 am

Post by sweety »

hi garvin,
Thank you so much for your reply.
Can I know why .bmp images cannot be created in web context?
I actually want images of any extension to be uploaded in my application.This is a high priority requirement.
Can you please suggest me any solution to my requirement?

Thanking you in advance,

Regards
sweety
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

1. BMP Images are not parsed by every OS. Linux and MacOS doesn't like it. BMP is a windows format.

2. BMP Images are badly compressed and are much too large

3. Displaying BMPs in Browsers often fails, because they have no rendering engine for BMPs.

You should always use PNG images, which is in every case the superior format.

AFAIK PHP doesn't offer BMP conversion facilities; image magick does, I think. You'd need to insert the missing mimetype, and checks for the conversion into include/functions_images.inc.php, if you would really need to do it.

I still advise you shouldn't. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sweety
Regular
Posts: 42
Joined: Tue Jul 05, 2005 11:05 am

Post by sweety »

Thank you garvin,
I will check the code to see if it can be changed or else just leave it....
Post Reply