Current location: Hot Scripts Forums » Programming Languages » PHP » Client Side Image Resize


Client Side Image Resize

Reply
  #1 (permalink)  
Old 03-11-08, 06:17 AM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
Client Side Image Resize

Something that is increasingly becoming a real pain for me is the quality of everyday digital cameras. People are starting to take huge photos with their 10megapixel cameras and they have no idea how to resize their photos before uploading to my site.

I currently use imagecopyresampled to resize the photos on upload but it has it's limitations and the photos have to be under a certain dimension otherwise it is too much load on the server.

Is there any way that the user can upload a photo but use their own computers processing and ram to resize before sending the image to my server? I know php is serverside but surely there is some answer to this.

Or maybe there is a way of resizing on upload that keeps the quality good but doesn't take too much resource from the server?
__________________
Aye!
Reply With Quote
  #2 (permalink)  
Old 03-11-08, 06:32 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Here are a couple of scripts that will allow you to resize the image on upload (server-side, not client-side):

http://blazonry.com/scripting/upload-size.php

http://www.hido.net/projects/phpThumbnailer/

I believe there are lots more on Hotscripts if you do a search for upload tools.
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 03-11-08, 06:48 AM
lnunesbr lnunesbr is offline
Newbie Coder
 
Join Date: Mar 2008
Location: São Paulo
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
JpGraph is a good one too...
http://www.aditus.nu/jpgraph/

Have so many options to edit your image...
Reply With Quote
  #4 (permalink)  
Old 03-11-08, 07:04 AM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
what is the best and server friendliest php function to just get the image file from a post and resize it?
I use imagecopyresampled but I know there are several other options such as imagecopyresize etc...
__________________
Aye!
Reply With Quote
  #5 (permalink)  
Old 03-28-08, 07:01 PM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
*BUMP*
Anyone?
__________________
Aye!
Reply With Quote
  #6 (permalink)  
Old 03-29-08, 05:09 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
I think imagecopyresampled is your best bet to be honest
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Reply With Quote
  #7 (permalink)  
Old 03-29-08, 05:28 AM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
Cheers. At the moment my script resizes the image on upload to a reasonable size, then it creates a thumbnail also using imagecopyresampled. So the script has to:
upload image, create one 400x400 pixel image and one 50x50 pixel image.

Obviously, I don't need the thumbnail to be best quality like the larger one. What is the least labour intensive method of shrinking an image for a thumbnail. I don't want to resize it with html each time the page loads for obvious reasons.
__________________
Aye!
Reply With Quote
  #8 (permalink)  
Old 03-29-08, 05:35 AM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Reply With Quote
  #9 (permalink)  
Old 03-29-08, 05:41 AM
Deansatch Deansatch is offline
Coding Addict
 
Join Date: Jul 2006
Location: Northumberland
Posts: 375
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks. Imagecopyresized it will be then!
__________________
Aye!
Reply With Quote
  #10 (permalink)  
Old 07-17-08, 03:41 AM
jrpowers jrpowers is offline
New Member
 
Join Date: Jul 2008
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hey -- a response post by my friend here recently got blasted because maybe it was percieved as some kind of advertisement..... but seriously, it wasn't an ad, do check out FJcore's open source Silverlight project as a viable solution to client-side resize (whereas imagecopyresized is just a server-side solution.)
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image resize onmouseover !!! CnB JavaScript 8 01-24-11 02:20 AM
asp image resize help sublok ASP 8 11-04-06 07:56 AM
PHP to generate HTML as loaded from client side mgscom PHP 2 01-14-06 12:02 AM
image resize and upload ascanio PHP 0 06-25-05 06:37 PM
Please help -- need to resize Access OLE image jinlynn ASP 0 09-13-04 10:29 PM


All times are GMT -5. The time now is 07:38 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.