473,573 Members | 3,904 Online
Bytes | Software Development & Data Engineering Community
+ 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 9803
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 programmaticall y e.g. through the onload event in the body tag
<body onload="changeS ize()">
<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.c om...
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.javas cript 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 programmaticall y e.g. through the onload event in the body tag
<body onload="changeS ize()">
<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.javas cript 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******** ************@co mcast.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 programmaticall y e.g. through the onload event in the body tag <body onload="changeS ize()">
<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.javas cript 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******** ************@co mcast.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.javas cript 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
3448
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 this page and reformat it so that it looks different. Do I use screen scraping to do this? Could someone please point me to a good screen scraping
5
1634
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
5023
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 that calls the web service to render a vertical strip of images. After doing some research I am unable to find some vb.net code that can assist...
10
2306
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. That is, images inline with the actual content of the blog itself. Is there an example that I can be pointed to, where I can examine some code and ...
3
2352
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 HMTL page without having to save them to the server and create a URL to the virtual directory? FYI: I currently am doing this with just single...
5
9209
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 included on his web page - so far, no problem. The issue is that the visitor needs to be able to pan around the image, possibly rotate it, definitely...
12
4755
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 on the client's computer? He/she could do this using the browser (file/save), but I need to have it done by pressing the pushbutton. In my...
19
6159
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 upload to a remote server they won't show. I checked the actual link, which is correct (e.g '../images/main/ brc.gif'). To make sure I also tried...
3
4006
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, while width and height is user specific - meaning user can change this on demand. My question is, although this rendering images on the fly is...
1
1222
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 wish to display. 2. Reload the uploads page if necessary and check the installed filename of the uploaded image via view-source. Occasionally it...
0
7661
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8165
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7730
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6347
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5550
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3692
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2163
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
984
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.