By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,637 Members | 2,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,637 IT Pros & Developers. It's quick & easy.

Is it possible to resize an image stored in database?

Nert
P: 64
Hi..,

I have this database, and images are stored in it. Now what i want is to flush these images out of the database to my webpage with the new size (new width, new height) without making it to deform. Is that possible? My current idea is to use the <img> tag, (ex: <img border=0 src='url' width=50 height=50 />) <--- but this always cause the image to stretch.

Is there any other way in PHP rather than using the <img> tag in html? anyone? please help.


thanks in advance (^_^)

--nert
Jan 24 '07 #1
Share this Question
Share on Google+
1 Reply


ronverdonk
Expert 2.5K+
P: 4,258
That is certainly possible with PHP and the GD library. There are numerous samples to be found on the web. One of the better ones is the following class at phpclasses.org. See the thumbnail and watermark class. There are many more in that site's Grahpics group. The following is a short description of its features
Features description:

- Thumbnail: normal thumbnail generation
- Auto-fitting: adjust the dimensions so that the resized image aspect is not distorted
- Scaling: enlarge and shrink the image
- Format: both JPEG and PNG are supported, but the watermark image can only be in PNG format as it needs to be transparent
- Autodetect the GD library version supported by PHP
- Calculate quality factor for a specific file size in JPEG format.
- Suport bicubic resample algorithm
Ronald :cool:
Jan 24 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.