/    Sign up×
Community /Pin to ProfileBookmark

shrinking big images

hi guys i have an image upload script, it uploads images just fine if they are small, but my client can’t upload her pics cause they are huge approx 2.5 mb
each.

the script works fine when i try to upload smaller images, and i explained to her that because they were so big they’ed take long to upload and make her pages take long to load and eat a lot of bandwith.

is there a way to have php create a smaller copy of each image as it uploads it?

my client has no idea how shrink them manually, and my only alternative would be to go to her and use a batch resizer to shrink their size.

the dimensions are fine, just that her camera takes big pics.

thanks for your help.

to post a comment
PHP

8 Comments(s)

Copy linkTweet thisAlerts:
@KDLAOct 28.2009 — Are you sure that this isn't a server problem/setting, rather than a scripting one?
Copy linkTweet thisAlerts:
@bsmbahamasauthorOct 28.2009 — Are you sure that this isn't a server problem/setting, rather than a scripting one?[/QUOTE]

i'm pretty sure the server simply needs to allow bigger uploads, but i'm thinking that displaying up to 20 2.5mb images in a photo gallery will slow down the page load time a lot and eat lots of bandwidth.

i'm trying to avoid having to manually pre-shrink the every image that needs to be uploaded, and my client doesn't know how to do it themselves.

the point of the site is to allow her to upload images of her rental homes, but all her images are so large and the server probably has a limit.

even if i have to upload them full sized, and then shrink them once they are uploaded i could do that, but i don't want to load up 20 big images every time a visitor clicks over to the photo gallery for each rental.
Copy linkTweet thisAlerts:
@KDLAOct 28.2009 — I don't believe there is a way to shrink the file size; only the dimensions. That would require a conversion process I think could only be handled by an image editor, than a web script, since you'd want to ensure that the image is optimized both in size AND appearance.
Copy linkTweet thisAlerts:
@bsmbahamasauthorOct 28.2009 — ok i'll wait to see if any other replies come in, but i do think i have a program that will let her drag and drop her files in batches that will do the resizing without any prompting
Copy linkTweet thisAlerts:
@hastxOct 29.2009 — The default upload filesize limit setting in PHP.ini is 2mb. If the host does not allow manipulation of this setting, you can not use php to upload larger files via php/http.

You will have to find out if you can override or reset this limit to allow larger files to be uploaded... Maybe, try ini_set(), you might get lucky but I dont know if PHP (or you host) allows file upload size to be overridden.

As far as the resize / page load / time issue, PHPThumb is an excellent library for this pupose. Regardless of image size, PHPThumb has the ability to cache thumbnails after it has resized the images, making it much faster to load thumbnails to a webpage without having to dynamically resize all the images on a page every time a request is made. See Here: http://phpthumb.sourceforge.net/
Copy linkTweet thisAlerts:
@weenisOct 29.2009 — PHP is server-side, so there's no way to shrink the image before or during upload with PHP. The only PHP solution would be to edit your php.ini as hastx said, then use the PHP image libraries to scale and save in the format you want.

You might consider a java uploader applet such as [url=http://jumploader.com/]JumpLoader[/url], which will scale the images (and do other things) on the client side, and upload the result.
Copy linkTweet thisAlerts:
@NogDogOct 29.2009 — There are a number of image resizing/optimizing web sites out there that your client may find easier to use than any full-fledged PhotoShop-type tool. See http://www.google.com/search?q=resize+optimize+images for some possibilities.
Copy linkTweet thisAlerts:
@bsmbahamasauthorNov 02.2009 — excellent responses, i didn't even think to give her a site to use do the resizing, cause i'm sure she'd struggle with a downloadable application.

thanks for all, i check into the librarys
×

Success!

Help @bsmbahamas spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...