473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

upload image - resize then save

Hi,
Could someone please point to to a tutorial / code for dynamically resizing
images on upload, THEN saving to disk on the webserver.
I need users to be able to upload images to my server, but they will not be
aware of optimising graphics for the web, if someone uploads a 300k 640x480
jpeg for example, i need to be able to shrink it down to a - say 400x300 65k
file BEFORE saving to my webserver.
I have been looking on the web and have found plenty of code for resizing
images and dynamically outputting an optimised images from heavy images that
reside on the server, but i need to shirnk it after getting it from the user
as an input stream before saving it to disk to save disk space.

in summary:
user uploads 600k jpeg via file field in web form
code then shrinks this down (may shrink physically or reduce quality or
both)
saves to disk a 65 k jpeg to disk on the webserver.

(note that i'm not interested in the GetThumbNailImage method for jpegs as
this produces too small an image)

I'm sure there is a tutorial out there for this, or if someone has code to
post here to this that would be fantastic

Thanks for any help.

Tim..
Nov 17 '05 #1
2 2343
You may be able to use the GetThumbnailImage method of the Image object.
Here's more info:
http://msdn.microsoft.com/library/de...ImageTopic.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Tim T" <br*********@hotmail.com> wrote in message
news:bo***********@news.wplus.net...
Hi,
Could someone please point to to a tutorial / code for dynamically resizing images on upload, THEN saving to disk on the webserver.
I need users to be able to upload images to my server, but they will not be aware of optimising graphics for the web, if someone uploads a 300k 640x480 jpeg for example, i need to be able to shrink it down to a - say 400x300 65k file BEFORE saving to my webserver.
I have been looking on the web and have found plenty of code for resizing
images and dynamically outputting an optimised images from heavy images that reside on the server, but i need to shirnk it after getting it from the user as an input stream before saving it to disk to save disk space.

in summary:
user uploads 600k jpeg via file field in web form
code then shrinks this down (may shrink physically or reduce quality or
both)
saves to disk a 65 k jpeg to disk on the webserver.

(note that i'm not interested in the GetThumbNailImage method for jpegs as
this produces too small an image)

I'm sure there is a tutorial out there for this, or if someone has code to
post here to this that would be fantastic

Thanks for any help.

Tim..

Nov 17 '05 #2
Thanks for your reply, but that doesn't really help... The thumbnails are
too small.
I have done a workaround where i am saving the uploaded image to disk first,
then resizing it and saving a smaller/optimised version.
still interested if anyone has seen a tutorial to do this in one step, or if
someone has code can they post it or email me
Thanks

Tim

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uf**************@TK2MSFTNGP10.phx.gbl...
You may be able to use the GetThumbnailImage method of the Image object.
Here's more info:
http://msdn.microsoft.com/library/de...ImageTopic.asp
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Tim T" <br*********@hotmail.com> wrote in message
news:bo***********@news.wplus.net...
Hi,
Could someone please point to to a tutorial / code for dynamically

resizing
images on upload, THEN saving to disk on the webserver.
I need users to be able to upload images to my server, but they will not

be
aware of optimising graphics for the web, if someone uploads a 300k

640x480
jpeg for example, i need to be able to shrink it down to a - say 400x300

65k
file BEFORE saving to my webserver.
I have been looking on the web and have found plenty of code for resizing images and dynamically outputting an optimised images from heavy images

that
reside on the server, but i need to shirnk it after getting it from the

user
as an input stream before saving it to disk to save disk space.

in summary:
user uploads 600k jpeg via file field in web form
code then shrinks this down (may shrink physically or reduce quality or
both)
saves to disk a 65 k jpeg to disk on the webserver.

(note that i'm not interested in the GetThumbNailImage method for jpegs as this produces too small an image)

I'm sure there is a tutorial out there for this, or if someone has code to post here to this that would be fantastic

Thanks for any help.

Tim..


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DH | last post by:
I have a "file upload form" that works OK, but I have been unsuccessful in my attempt to also resize the uploaded .JPG (if it is too wide), over-writing the original .JPG, and then create and save...
5
by: bob garbados | last post by:
I am trying to create a database-driven photo gallery for a friend with an admin form to upload images... I can upload a file to the web server, but I want to store the image in a database and I...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
0
by: dann2 | last post by:
hello, i try to upload in an access db two pictures at the same time. i use the adjusted sample code from persits. it looks like this: ... '<% ' Create an instance of AspUpload object 'Set...
5
by: bungle | last post by:
Hi Would anyone be able to offer advice on how they would upload images to SQL Server 2005 so that if they are too big the system will automatically resize them first? Obviously you need to get...
3
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
1
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need ...
7
by: xx75vulcan | last post by:
Hi, I've got a PHP Upload Form that works great, unless that is, the image your uploading has been modified through a photo editing software. Example: if I upload the image straight from a...
7
by: mishrarajesh44 | last post by:
hii all Truly telling i hav got this code from net & i am finding error while running the code below.. code:- <?php $idir = "photo/"; // Path To Images Directory $tdir =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.