473,468 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Client-side function to resize ".jpg" images

Don
Does anyone know where I can find a client-side function I can reference from within an
HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it
on the client-side and not have to upload the large raw image to the server.

Thanks in advance for your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 23 '05 #1
9 9790
On Thu, 18 Nov 2004 10:42:57 -0700, Don wrote:
Does anyone know where I can find a client-side function I can reference from within an
HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it
on the client-side and not have to upload the large raw image to the server.


So instead you want to upload a 400Kb image, serve that 400Kb
to your users, and have a client-side solution to rescale the
image to a smaller size (that could have been served in 100Kb)?

That is insane.

And, no. Certainly not in any reliable, crossbrowser way
using JS, but it is possible (very poorly) using HTML.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #2
Don
On Fri, 19 Nov 2004 00:18:32 GMT, Andrew Thompson <Se********@www.invalid> wrote:
On Thu, 18 Nov 2004 10:42:57 -0700, Don wrote:
Does anyone know where I can find a client-side function I can reference from within an
HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it
on the client-side and not have to upload the large raw image to the server.


So instead you want to upload a 400Kb image, serve that 400Kb
to your users, and have a client-side solution to rescale the
image to a smaller size (that could have been served in 100Kb)?

That is insane.

And, no. Certainly not in any reliable, crossbrowser way
using JS, but it is possible (very poorly) using HTML.

Andrew,

Thanks for your response. But, you kinda got it all wrong. I want a client-side function to which
I can submit a client camera size image (3 megapixel, etc.) and have it resized to 700 pixels wide
at a ".jpg" compression-level that results in a file size around 100 KB. Then, I want to take that
and ship it off to my PHP script running on the server. That script then puts the 100 KB image in a
PictureVault folder. Users can then access pictures in the PictureVault. I'm already doing this,
except I take their 3 megapixel picture and immediately upload it to the PHP script. I want to cut
down on the bandwidth (transfer rate) on the server end.

Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 23 '05 #3
On Thu, 18 Nov 2004 20:28:36 -0700, Don wrote:
Thanks for your response. But, you kinda
got it all wrong. I want a client-side function ...


(slaps forehead) D'uhh! Just like you said in your
opening sentence, ..and subject. *Still* I completely
missed it.

My bad. Sorry for wasting the bandwidth.

No, I don't have a solution to the stated problem.

Though, (musing)..

I imagine that while their might be an ActiveX object for
IE that will do this in a (possibly signed) script(/HTA),
it would not be cross-browser. [ You'll need to consult
the JS experts on that. ]

OTOH, you might look to a signed Java applet (though note
that Java is a separate language to Javascript, and requires
the Java Plug-In from Sun).

HTH

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Jul 23 '05 #4
you can just insert the smaller height and/or width into the img tag
<img name="imgName" id="imgId" src="pic.jpg" width="120">

or change it programmatically e.g. through the onload event in the body tag
<body onload="changeSize()">
<script type="text/javascript">
function changeSize() {
// not tested
// get a reference to the image by whatever standards you wish to support
var obj = document.images['imgName']; // pretty safe
obj.style.width='140px';
</script>
HTH
Jimbo
"Don" <no@adr.com> wrote in message
news:gi********************************@4ax.com...
Does anyone know where I can find a client-side function I can reference from within an HTML/JavaScript web page? I'm currently using a core PHP function to do this, but I'd rather do it on the client-side and not have to upload the large raw image to the server.
Thanks in advance for your help.
Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

Jul 23 '05 #5
Andrew Thompson <Se********@www.invalid> wrote in message news:<gt*****************************@40tude.net>. ..
I imagine that while their might be an ActiveX object for
IE that will do this in a (possibly signed) script(/HTA),
it would not be cross-browser. [ You'll need to consult
the JS experts on that. ]

OTOH, you might look to a signed Java applet (though note
that Java is a separate language to Javascript, and requires
the Java Plug-In from Sun).


There must already be a Java plug-in that does it, since it is such a
common need. But if not, I've been thinking about writing one to work
with my own PHP CMS. One of the most frequent requests I get is people
who take a picture with their digital camera and then upload and then
complain to me that it is way to big on the web site (16 inches wide,
or so).
Jul 23 '05 #6
lawrence wrote:
Andrew Thompson <Se********@www.invalid> wrote in message news:<gt*****************************@40tude.net>. ..
I imagine that while their might be an ActiveX object for
IE that will do this in a (possibly signed) script(/HTA),
it would not be cross-browser. [ You'll need to consult
the JS experts on that. ]

OTOH, you might look to a signed Java applet (though note
that Java is a separate language to Javascript, and requires
the Java Plug-In from Sun).

There must already be a Java plug-in that does it, since it is such a
common need. But if not, I've been thinking about writing one to work
with my own PHP CMS. One of the most frequent requests I get is people
who take a picture with their digital camera and then upload and then
complain to me that it is way to big on the web site (16 inches wide,
or so).


It would be easier, simpler, and more productive to create a page that
explains how to resize images in image-editing software.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #7
J. J. Cale wrote:
you can just insert the smaller height and/or width into the img tag
<img name="imgName" id="imgId" src="pic.jpg" width="120">

And how exactly does that change the physical size of the image? Which
is what the OP wanted and your img tag fails to do.

or change it programmatically e.g. through the onload event in the body tag
<body onload="changeSize()">
<script type="text/javascript">
function changeSize() {
// not tested
// get a reference to the image by whatever standards you wish to support
var obj = document.images['imgName']; // pretty safe
obj.style.width='140px';
</script>


See Above.

Read the group FAQ, as linked to in my signature.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #8

"Randy Webb" <Hi************@aol.com> wrote in message
news:GN********************@comcast.com...
J. J. Cale wrote:
you can just insert the smaller height and/or width into the img tag
<img name="imgName" id="imgId" src="pic.jpg" width="120">


And how exactly does that change the physical size of the image? Which
is what the OP wanted and your img tag fails to do.


I believe the OP just wanted to display the image at a smaller size, and not
actually resize the image.
or change it programmatically e.g. through the onload event in the body tag <body onload="changeSize()">
<script type="text/javascript">
function changeSize() {
// not tested
// get a reference to the image by whatever standards you wish to support var obj = document.images['imgName']; // pretty safe
obj.style.width='140px';
</script>


See Above.

Read the group FAQ, as linked to in my signature.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

Jul 23 '05 #9
J. J. Cale wrote:
"Randy Webb" <Hi************@aol.com> wrote in message
news:GN********************@comcast.com...
J. J. Cale wrote:

you can just insert the smaller height and/or width into the img tag
<img name="imgName" id="imgId" src="pic.jpg" width="120">

And how exactly does that change the physical size of the image? Which
is what the OP wanted and your img tag fails to do.

I believe the OP just wanted to display the image at a smaller size, and not
actually resize the image.


Perhaps, but this part of the post:
<quote>
I'm currently using a core PHP function to do this, but I'd rather do
it on the client-side and not have to upload the large raw image to the
server.
</quote>

Implies, to me, that they are using the image functions in PHP to resize
it after upload. If the only purpose to resizing it, prior to upload, is
to alter its display in the browser, I don't see the purpose of doing that.

However, if resizing it (physically) prior to upload is the desire, it
makes good sense to me.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #10

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

Similar topics

4
by: rachel | last post by:
Hello, I am currently contracted out by a real estate agent. He has a page that he has created himself that has a list of homes.. their images and data in html format. He wants me to take...
5
by: viktor9990 | last post by:
I wonder if it is possible to encrypt images(like .tiff or .gif files) in asp.net? How? Any exampel code or url will be appreciated. Thanks
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
10
by: Neo Geshel | last post by:
I am seeking to hand-roll my own blog in ASP.NET 2.0 and SQLExpress 2005. Why? Because I can. Because I will gain experience. The one thing that has me stumped at square one is inline images....
3
by: CLEAR-RCIC | last post by:
I have several images i want to display in an ASP.Net application. The images are being passed to me in binary format from another application. Is there a good way to write them directly to an...
5
by: Michael Satterwhite | last post by:
I need some help and have no idea where to start. I'm posting here because it's going on a web page, but I'm not sure there *IS* a best forum for this. I have a client that has images he wants...
12
by: =?Utf-8?B?RnJlZU5FYXN5?= | last post by:
Hello, the scenario: There's an ASPX page which shows some text and has three buttons at the bottom: Save, Print and Close. Print and close is done by javascript. But how can I save the page...
19
by: marckatsambis | last post by:
Hi, I'm struggling to find answers on the problem I'm having, and I desperately need some closure :) I have a bunch of background-images in a css file that are visible locally, but when I...
3
by: wardemon | last post by:
Hi All, I have a aspx page named: ImageProcess.aspx that creates a thumbnail version of an image by passing the ImagePath, width, and height. The ImagePath is taken from a table from a database,...
1
by: Neredbojias | last post by:
Eureka. You can now show your demo images and screencaps quite easily. Here's how: 0. Go to my site - http://www.neredbojias.net/ 1. Go to the Visitor's Upload Page and upload the image you...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.