473,786 Members | 2,566 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 9826
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
3470
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
1655
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
5044
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 in what I want to achieve. The closest thing I found was
10
2368
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 figure out how to do this? Frankly I haven't got a clue, aside from breaking the content up into...
3
2366
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 images. I do a Response.BinaryWrite(byte) to display the one image. The advantage is that I never...
5
9215
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 zoom in and out. To me (feel free to correct me), that sounds like a vector graphic tool, but I'm...
12
4778
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 serverside code I get the button-click-event, I also know how to get
19
6184
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 the URL approach (e.g. 'http://
3
4015
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 cool, I would like to implement some sort of mechanism/logic that it wont keep rendering the thumbnail...
1
1233
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 may not be the same as
0
9496
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9961
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7512
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
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

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.