This is a discussion on "Resize image-how to get lenght of image" within the PHP Forum section. This forum, and the thread "Resize image-how to get lenght of image are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Resize image-how to get lenght of image
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Hello,
I have one site Used cars for sale. At the minute I can crop jpg, gif images. but problem is with bmp. Does some one know script like if I got bmp image to upload, how can I crop that image using createfromimage function or any other easy way to do. 2nd question is, if I want to know lenght of image or width of image with which function I can find exact lenght of image. thanks Web Developer |
|
|
|
#2
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
Also, just thinking outside of the box for a moment:-
Due to file size of bmp's, is it possible to convert any bmp files uploaded on this site into jpg format before rendering? |
|
#3
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
As I know, it is not possible. There is one function used createfrombmp, which we used for bmp images but I tried alot and it does not work, I dont know what is wrong. I have read on php.net but found no solution.
Web Developer |
|
#4
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
i don't seem to see where's the problem, if u say u have searched so much.
"image/bmp" as type. php.net/imagesx |
|
#5
|
|||
|
|||
|
Actually someone suggest me solution that in which we can change images into jpg, which i dont know before. so i was wrong.
Regarding issue bmp issue, I will explain bit more here I got script in which we use gd function , which resize the images in smaller size for thumbnails. I am only having problems in ImageCreateFromWBMP but ImageCreateFromgif ImageCreateFromjpeg works ok. According php.net and I searched on the net ImageCreateFromWBMP should work fine for bmp images. I chekced php version, it is fine too. It do not create image using "ImageCreateFromWBMP " The script is something like this, $function_suffix=WBMP; $size = GetImageSize($images_dir . "/" . $filename); $function_to_read = 'ImageCreateFrom' . $function_suffix; $function_to_write = 'Image' . $function_suffix; // Read the source file $source_handle = $function_to_read($images_dir . '/' . $filename); $destination_handle = ImageCreateTrueColor($thumbnail_width, $thumbnail_height); ImageCopyResampled($destination_handle, $source_handle, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1]); $function_to_write($destination_handle, $images_dir . '/tb_' . $filename); This is part of function, using in the script. I dont know what the error is and how can find error that why it not creating thumnail of image and why the same thing doing fine for jpg and gif images. Web Developer |
|
#6
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
What error message do you get? There might be a clue in that.
ImageCreatefromWMBP is only available if your PHP was built with GD 1.8 or later ImageCreatefromBMP was available from PHP 4.0.1. GetImageSize has been available for a very long time, but only works on WBMP files from release 4.3.2. It does NOT depend on the GD library. I would suggest that you change from using GetImageSize to ImageSx after you've loaded in your image. Then you'll be consistently using the GD library, and not reading the WBMP twice. Last edited by grahame; Sep 17th, 2006 at 08:29. |
|
#7
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
Easier way: it's to convert BMP into JPEG. And yes it's possible.
And converting BMP using GD. There's no pre-defined function, you just need to create a function with a few tweaks. Google it. And forget WBMP it's not BMP. Totally different things. |
|
#8
|
|||
|
|||
|
sound likes ok, i will try to covert in jpg and then see how it goes.
|
|
#9
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
I am no PHP whizz but wouldn't ImageMagik do this?
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
|
|
#10
|
|||
|
|||
|
Re: Resize image-how to get lenght of image
he already has a working function, he will just conver the bmp into jpeg, and everything will be fine.
|
![]() |
| Tags |
| resize, imagehow, lenght, image |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [SOLVED] multiple image rollover not restoring image | snappy | JavaScript Forum | 4 | Nov 5th, 2007 14:38 |
| Resize dynamically loaded image | nate2099 | Flash & Multimedia Forum | 2 | Aug 31st, 2007 22:36 |
| Background image overlaping footer image at bottom of div | lw_d | Web Page Design | 4 | Mar 21st, 2006 00:27 |
| PHP Image Resize problem | jono | PHP Forum | 6 | Jun 7th, 2005 11:34 |