473,385 Members | 1,736 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,385 software developers and data experts.

dynamic image (png) file

I've recently seen a couple of sites that have dynamically generated .png
files on them and I'm wondering how to do it in c#, or if it's a server side
thing. Here are a couple of links:
http://www.serverspy.net/bin/hmon/12...15/0/image.png
http://miniprofile.xfire.com/gaspar.png

Both of these images are real-time/dynamically generated, but they have a
..png extension. I understand how to create/manipulate and render images in a
..aspx page, but the image tag has to point to an .aspx page address to work.
How are these images being generated with a .png extension?

My first guess would be that the mapping for the .png extension is being
changed ont the server to use whatever scripting language the site is
supported. Since the images are generated real-time I'd rule out saving temp
files for display purposes.

Any ideas/help will be appreciated.

Thanks.
Nov 19 '05 #1
4 2103
>My first guess would be that the mapping for the .png extension is being
changed ont the server to use whatever scripting language the site is
supported. Since the images are generated real-time I'd rule out saving
temp
files for display purposes.


Exactly. For example with ASP.NET, .png extension could be mapped first in
IIS to ASP.NET ISAPI, so that ASP.NET can process those requests and then
yet, it could be a custom HTTP handler (a page or a custom handler) to
process the request at ASP.NET side.

There could be temp files with this approach (depends howe the HTTP handler
works) but not necessarily, it could also use output caching to ease the
request processing burden.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Nov 19 '05 #2
(comments inline)

"Phil" <Ph**@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I've recently seen a couple of sites that have dynamically generated .png
files on them and I'm wondering how to do it in c#, or if it's a server side thing. Here are a couple of links:
http://www.serverspy.net/bin/hmon/12...15/0/image.png
http://miniprofile.xfire.com/gaspar.png
Neat, isn't it. :)

Both of these images are real-time/dynamically generated, but they have a
.png extension. I understand how to create/manipulate and render images in a .aspx page, but the image tag has to point to an .aspx page address to work. How are these images being generated with a .png extension?

It is possible to write HTTP protocol handlers in C# or other .NET languages
and then assign a handler for the .png extension for the individual web
application in the IIS settings dialogues.
My first guess would be that the mapping for the .png extension is being
changed ont the server to use whatever scripting language the site is
supported. Since the images are generated real-time I'd rule out saving temp files for display purposes.


A primitive way of writing it would be to save it as a temp file, but if you
have drawn something programmatically, it is usually simple to stick it in a
MemoryStream object and attach it to the response inside the protocol
handler.

-- Sean M, who admittedly has not tried this himself so correct me if I'm
off base on this
Nov 19 '05 #3
Thanks for the help ;).

I'm not familiar with http handlers. Is this something that would have to
also be implemented through IIS, as well as code? I'm currently hosting
through a third party hosting company and I'm pretty sure I won't be able to
change IIS mappings/settings.

Thanks!

"Sean M" wrote:
(comments inline)

"Phil" <Ph**@discussions.microsoft.com> wrote in message
news:C8**********************************@microsof t.com...
I've recently seen a couple of sites that have dynamically generated .png
files on them and I'm wondering how to do it in c#, or if it's a server

side
thing. Here are a couple of links:
http://www.serverspy.net/bin/hmon/12...15/0/image.png
http://miniprofile.xfire.com/gaspar.png


Neat, isn't it. :)

Both of these images are real-time/dynamically generated, but they have a
.png extension. I understand how to create/manipulate and render images

in a
.aspx page, but the image tag has to point to an .aspx page address to

work.
How are these images being generated with a .png extension?


It is possible to write HTTP protocol handlers in C# or other .NET languages
and then assign a handler for the .png extension for the individual web
application in the IIS settings dialogues.
My first guess would be that the mapping for the .png extension is being
changed ont the server to use whatever scripting language the site is
supported. Since the images are generated real-time I'd rule out saving

temp
files for display purposes.


A primitive way of writing it would be to save it as a temp file, but if you
have drawn something programmatically, it is usually simple to stick it in a
MemoryStream object and attach it to the response inside the protocol
handler.

-- Sean M, who admittedly has not tried this himself so correct me if I'm
off base on this

Nov 19 '05 #4
With ASP.NET , yes, it would need a mapping in IIS because IIS is the first
one to direct the request to the correct place for processing. This is a
different case with IIS 7, but that won't help here for a few years. :-)

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
Nov 19 '05 #5

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

Similar topics

2
by: Cybex | last post by:
Who knows how this is done: http://www.danasoft.com/vipersig.jpg As you can see the signature is dynamical, it uses gdlib I assume and php. But does anybody have any code for this? Please help...
8
by: Krzysztof Kujawski | last post by:
I'm trying to get an image to analize by imagecreatefrompng(http://www.domain.pl/png.php); The file png.php is generating a PNG file different for all logged users in domain (cookies are used in...
5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
2
by: Markus Mohr | last post by:
Hi, everyone, I have a special problem: For every monitor resolution in 200 pixel steps from 800 to 1600 pixels I have an image to be shown as centered background-image. Those images all...
7
by: JavaScriptRocks | last post by:
I've been trying to imitate / reverse engineer the add attachment feature in gmail composer. I managed to do it to say about 80% but its giving me trouble in IE on WinXP-Sp2. I am using PHP to do...
18
by: Andrew Christiansen | last post by:
Hey all. The images I create in photoshop with semi-transparent pixels (for instance in Photoshop text with a dropshadow with a transparent canvas) I've been saving in PNG format and then using...
0
by: Independent | last post by:
Python programmers may find the application to decoding an encrypted map image format known as Memory Map to produce a standard PNG image file interesting. Someone obviously very well versed in...
1
by: neovantage | last post by:
Hey all, I am using a PHP script which creates headings at run time in a sense at page execution. I am stuck a with a very little problem which i am sure i will have the solution from experts. ...
2
by: neovantage | last post by:
Hey all, I have created transparent PNG images from text dynamically. But it edges are pixel-ate or we can say edges are distorted. Here is my LINK which shows my generated transparent PNG image....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.