Resize image-how to get lenght of image

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.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 16th, 2006, 19:11
Junior Member
Join Date: Sep 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Resize image-how to get lenght of image

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 16th, 2006, 19:21
Highly Reputable Member
Join Date: Aug 2005
Location: 3rd Branch Up, Old Oak.
Age: 48
Posts: 658
Thanks: 0
Thanked 0 Times in 0 Posts
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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Sep 16th, 2006, 19:27
Junior Member
Join Date: Sep 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Sep 16th, 2006, 22:16
Junior Member
Join Date: Sep 2006
Location: Portugal
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Sep 16th, 2006, 23:29
Junior Member
Join Date: Sep 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Re: Resize image-how to get lenght of image

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Sep 17th, 2006, 04:23
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Sep 17th, 2006, 04:24
Junior Member
Join Date: Sep 2006
Location: Portugal
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Sep 19th, 2006, 12:21
Junior Member
Join Date: Sep 2006
Location: uk
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Re: Resize image-how to get lenght of image

sound likes ok, i will try to covert in jpg and then see how it goes.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Sep 19th, 2006, 18:49
Elite Veteran
Join Date: Aug 2005
Location: That Place
Posts: 2,044
Blog Entries: 1
Thanks: 0
Thanked 37 Times in 37 Posts
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)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Sep 19th, 2006, 22:39
Junior Member
Join Date: Sep 2006
Location: Portugal
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
resize, imagehow, lenght, image

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 21:46.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42