473,769 Members | 5,449 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating thumbnails

Guys

I was wondering if it was possible to have a js file that, when the page
loaded, it automatically generated a a set of thumbnails from directory
of the page on the web server?

Or would this create an unacceptable security hazard?

TTFN
Barely
Jun 7 '07 #1
4 1779
Barely Audible wrote:
Guys
What about the gals, huh? You chauvinistic pig. ;)
I was wondering if it was possible to have a js file that, when the page
loaded, it automatically generated a a set of thumbnails from directory
of the page on the web server?
Well, sure you can. However, there is a problem. I'll tell you at the
end of my post.

var imgs = ['my_mom', 'my_child', 'some other picture', 'pron'];

for (var i = 0, l = imgs.length; i < l) i++)
{
var new_img = document.create Element('img');
new_img.src = imgs[i] + '.jpg'; // or you could store the extension
document.getEle mentsByTagName( 'body')[0].appendChild(ne w_img);
}

Or you could just loop the array and write the results to the page using
the write method or innerHTML.
Or would this create an unacceptable security hazard?
The problem is by not creating thumbnails server-side or at least with
an image resizing application, you are creating unnecessary loading
times. Not to mention the fact that you end up loading too much
information in the user's browser or other viewing device.

Think on this. If I have ten images that are each 10 megabytes, then
the user has to load 100 megabytes of information just to view
thumbnails that you resize via CSS or JavaScript.

Serve them resampled thumbnails and you eliminate this problem.

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 7 '07 #2
-Lost wrote:
for (var i = 0, l = imgs.length; i < l) i++)
for (var i = 0, l = imgs.length; i < l; i++)

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 7 '07 #3
oink oink Guilty as charged ;-)

You have a valid point... as regards file size fortunately they do not
get that size and double figures KB is more the norm. The problem is
that the contents of the directory changes 10-15 times a day! I would be
forever redoing thumbnails if I had to do it manually :-(

You know of an example of this type of script in action?

-Lost wrote:
Barely Audible wrote:
>Guys

What about the gals, huh? You chauvinistic pig. ;)
>I was wondering if it was possible to have a js file that, when the page
loaded, it automatically generated a a set of thumbnails from directory
of the page on the web server?

Well, sure you can. However, there is a problem. I'll tell you at the
end of my post.

var imgs = ['my_mom', 'my_child', 'some other picture', 'pron'];

for (var i = 0, l = imgs.length; i < l) i++)
{
var new_img = document.create Element('img');
new_img.src = imgs[i] + '.jpg'; // or you could store the extension
document.getEle mentsByTagName( 'body')[0].appendChild(ne w_img);
}

Or you could just loop the array and write the results to the page using
the write method or innerHTML.
>Or would this create an unacceptable security hazard?

The problem is by not creating thumbnails server-side or at least with
an image resizing application, you are creating unnecessary loading
times. Not to mention the fact that you end up loading too much
information in the user's browser or other viewing device.

Think on this. If I have ten images that are each 10 megabytes, then
the user has to load 100 megabytes of information just to view
thumbnails that you resize via CSS or JavaScript.

Serve them resampled thumbnails and you eliminate this problem.
Jun 8 '07 #4
Barely Audible wrote:
oink oink Guilty as charged ;-)

You have a valid point... as regards file size fortunately they do not
get that size and double figures KB is more the norm. The problem is
that the contents of the directory changes 10-15 times a day! I would be
forever redoing thumbnails if I had to do it manually :-(

You know of an example of this type of script in action?
Do it on the server once. And not on the client.

Rene
Jun 9 '07 #5

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

Similar topics

5
5195
by: Lemming | last post by:
Hi, I'm putting together a website for a local estate agent. One of the things they want to do is upload property descriptions/prices/etc. plus a picture of the property which is for sale.
5
3672
by: Ken | last post by:
I am in the process of designing my first web-site, and am having a problem with my picture gallery. My thumbnails are all different sizes, I would like them to be one size. The manual does not address this situation. Where did I go wrong?
3
11402
by: Vagabond Software | last post by:
I'm trying to display thumbnail images in a Listview that look more like the Windows thumbnail view. Everything is working pretty good, but my thumbnails are decidedly not like the Windows thumbnails. View the following snapshot to compare the Windows thumbnails (top) to my ListView thumbnails (bottom): http://home.san.rr.com/vagabondia/images/tmp/sample.gif It looks like the Windows thumbnails retain their proportion by, perhaps,
8
3211
by: Fabricio Sperandio | last post by:
Hi everyone, I am trying to generate some thumbnails using System.Drawing.Image Class. Actually the GetThumnailImage method. The question is: How can I get a better thumbnail picture? I mean, when the original size is big, for example, 800x600 and I generate a small picture (160x120) the quality is terrible for a jpeg and even orse for a gif. How can I get some better images? There is another class? There is some resolution propertie I...
6
4759
by: Rich | last post by:
Hello, I want to simulate the dynamic thumbnail display of Windows Explorer (winxp) on a form or pannel container. If I place a picture box on my container form/pannel and dimension it to the size of a thumbnail and set the sizemode to Stretch -- I get one thumbnail. I want to retrieve all the picture files (jpg, bmp) in a directory into an array list and then display this list as thumbnails on my form dynamically. So my question is...
1
3234
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project gallery. ( http://xahlee.org/Periodic_dosage_dir/lanci/lanci.html ) Comments and versions in other lang welcome. Xah
0
5497
by: rose.kevin | last post by:
Hi I am trying to get Windows Explorer to display thumbnails for my own custom filetype. I have found plenty examples out there telling me how to extract thumbnails from explorer for your own use, but I want to go the other way around. I have implemented the IExtractImage interface:
5
1992
by: JJ | last post by:
I have a gallery-like application. (The gallery will be actually presented in Flash, but the management (cms) of the images will be in asp.net. ) My question is, is it ok to create Thumbnail images on the fly by resizing the original sending it to the output stream (i.e. Response.ContentType = "image/jpeg"; Response.BinaryWrite(imageContent) ), or best to actually save the thumbnails to disk. Would this method result in a much slower...
1
1155
by: iswar | last post by:
hi friends asp.net(2.0) c# i am trying to create an image gallery in which all the uploaded image are converted into thumbnails and i want to bind these thumbnails into gridview. and on clicking in this thumbnails displayed in grid the orginal image is shown in a pop-up. now i hav succeded in creating thumbnails from uploaded images pls any one help me how to bind these thumbnails in gridview by storing it in a folder.. thanks a lot for...
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9424
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
10051
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...
1
10000
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7413
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
6675
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
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
3
2815
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.