how to change image width and height
Moderator: General Moderators
how to change image width and height
is there any function in php with which we can change the width and height of an image.i have seen so many functions which can get the image wifth and height but i could not find the function which can change the image width and height.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
The physical dimensions of an image can only be changed through the use of ImageMagik or the GD libs via PHP.
ImageMagik is a command line tool which you can exec commands to from PHP:
http://freealter.org/doc_distrib/ImageMagick-5.1.1/
Or with the use of GD you can manipulate the image:
http://www.boutell.com/gd/
Both require you to have certain libs/binaries installed on your server.
Regards,
ImageMagik is a command line tool which you can exec commands to from PHP:
http://freealter.org/doc_distrib/ImageMagick-5.1.1/
Or with the use of GD you can manipulate the image:
http://www.boutell.com/gd/
Both require you to have certain libs/binaries installed on your server.
Regards,
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
If you have a version of GD beyond 2.0 you could adapt my thumbnailing class to do the resizing
http://www.teckis.com/scriptix/thumbnails/teck.html
for simple resizing, just
$variable = new Thumbnail('resource.jpg',200,150,'output_image.jpg',85,'');
$variable->create();
would be all that is required (after including the class
).
http://www.teckis.com/scriptix/thumbnails/teck.html
for simple resizing, just
$variable = new Thumbnail('resource.jpg',200,150,'output_image.jpg',85,'');
$variable->create();
would be all that is required (after including the class