This is a discussion on "Automatic file size reduction" within the PHP Forum section. This forum, and the thread "Automatic file size reduction are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Automatic file size reduction
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Automatic file size reduction
Hi
I have a web site that allows users to upload pictures but i only allow them a maximum of 500kb per picture. What would be nice if it can be done is that when they upload there pictures it will automatically reduce the file size to 500kb, can this be done? This would then save my advertisers time and inconvineience hence i might get more people advertising. TY |
|
|
|
#2
|
||||
|
||||
|
Re: Automatic file size reduction
The best way to do this would be to resize the image to a predetermined max height/width. You would be able to do this with the PHP GD module.
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
#3
|
|||
|
|||
|
Re: Automatic file size reduction
Thanks, any resources you can point me to to achieve this. Or a working example wouild be great.
|
|
#4
|
||||
|
||||
|
Re: Automatic file size reduction
Okay here's a quick example using a file found in $_FILES['pic']..
The error handling is tack as it's only an example
I don't work with images too often but that's a quick look at how I would do it... I went pretty quickly so the maths is a bit chunky
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Last edited by Rakuli; Feb 12th, 2008 at 15:29. Reason: syntax error in first and second ifs - and allowed |
|
#5
|
|||
|
|||
|
Re: Automatic file size reduction
wow thanks thats a great example, wasnt expecting anything that good
Thanks again |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Best way to reduce file size of .jpg | lmc148 | Graphics and 3D | 12 | Jan 17th, 2008 07:43 |
| Image file size help | danny322 | Graphics and 3D | 6 | Nov 9th, 2007 11:20 |
| Reducing File (jpg) size in asp | ish | Classic ASP | 2 | Aug 1st, 2007 11:44 |
| large php file size | geoffmuskett | PHP Forum | 5 | Jun 20th, 2007 14:54 |
| Need help with E-Card file size | amber | Graphics and 3D | 7 | Jun 19th, 2007 06:24 |