473,513 Members | 2,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding an logo-image/tekst to an existing image.

On my webpage I am making I want that if users view any image in my gallery
a small logo/tekst will appear in the image.
I know it's possible but I haven't got a clue how to get a logo or tekst on
a image.

Does someone got an example or somewhere I can read more about it except the
MSDN?

thx in advance.

Richard
Nov 18 '05 #1
6 1932
On Tue, 15 Jun 2004 20:20:10 +0200, "Richard" <ri*****@nospam.com>
wrote:
On my webpage I am making I want that if users view any image in my gallery
a small logo/tekst will appear in the image.
I know it's possible but I haven't got a clue how to get a logo or tekst on
a image.

Does someone got an example or somewhere I can read more about it except the
MSDN?

thx in advance.

Richard


you can use System.Drawing.Image. you will have to read about this
class as well as the Bitmap class in order to be able to combine an
image with another.

-Adam
Nov 18 '05 #2
Hi Richard,

As for how to manipulating image in asp.net web application and add some
mark/logo in it so as to protect them from linked by other user or sites.
Here are my suggestions:

First of all, Adam's suggestion that use the GDI+ api under the
System.Drawing.Image namespace is quite reasonable and it has provided
sufficient interfaces for manipulating image. And as for add our custom
flag/mark in the image in our web app when they're requested by other
users, gerenally we need to do the following steps:

1. Define a HttpHandler to service all the image request and use GDI+ code
to manipulate the image and output it to user.

2. After built the HttpHandler , register it in web.config of the asp.net
web application. And don't forget to set the ISAPI extension in IIS's
virtual dir ,we have to mapp the image extension(we want to processed by
our handler) to the aspnet_isapi.dll.

In addition, here are some tech articles discussing manipulating image in
asp.net

#Watermark Website Images At Runtime
http://www.codeproject.com/aspnet/httpImageHandler.asp

#HTTP Handlers for Images in ASP.NET
http://www.c-sharpcorner.com/Code/20...sForImages.asp

#Image Generation Service for ASP.NET 1.1
http://msdn.microsoft.com/msdnmag/is...e/default.aspx

Hope also helps. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3
As Steven said.
Here is a piece of code I used to implement such a http handler. The
handler is adding some text to the image. You should remove the security
check...

public class AddJpegCopyrightHttpHandler : IHttpHandler
{
const string COPYRIGHT_NOTICE = "© a copyright notice";
private SolidBrush brush = new SolidBrush(Color.Gray);

public AddJpegCopyrightHttpHandler()
{
}

#region Implementation of IHttpHandler
public void ProcessRequest(System.Web.HttpContext context)
{
string filePath = context.Request.MapPath(context.Request.FilePath);

PhotoGaleryPrincipal user = System.Web.HttpContext.Current.User as
PhotoGaleryPrincipal;
bool isPrivate = filePath.IndexOf("\\PrivateGalery\\") != -1;
if( (user == null && isPrivate) || (user != null &&
!user.AlowPrivateAccess && isPrivate) )
{
throw new System.Security.SecurityException("The picture you
requested is in a private galery. You must be logged in and have access
to private galeries to access this picture.");
}

Bitmap photo = (Bitmap)Bitmap.FromFile(filePath);
if( photo.Width > 200 && photo.Height > 200 )
{
Graphics g = Graphics.FromImage(photo);
Font font = new Font("verdana", photo.Height / 100);
SizeF size = g.MeasureString(COPYRIGHT_NOTICE, font);
g.DrawString(COPYRIGHT_NOTICE, font, brush, photo.Width -
size.Width - 10, photo.Height - size.Height * 1.2F);
g.Dispose();
}
context.Response.ContentType = "image/jpeg";
photo.Save(context.Response.OutputStream, ImageFormat.Jpeg);
}

public bool IsReusable
{
get
{
return true;
}
}
#endregion
}

hope this helps
____________________
www.bloomfield.as.ro
Nov 18 '05 #4
Hi Richard,

Have you had a chance to check out the suggestions in the former replies or
have you got any further ideas on this issue? If there're anything else we
can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #5
the HTTPHandler stuff is still a bit out of my league. atm I am reading more
about it and
from all I have seen I like what you can do with it so its a much know for
me.

I still have some issue's with putting another logo on an existing image but
the text works for me now.
I guess I just have to read some more and play a bit with it.

Anyway, thx for the help,

Richard

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> schreef in bericht
news:QH**************@cpmsftngxa10.phx.gbl...
Hi Richard,

Have you had a chance to check out the suggestions in the former replies or have you got any further ideas on this issue? If there're anything else we
can help, please feel free to post here. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #6
Hello Richard,

Steven is OOF these two days. :) However, if there is any more question on it, please feel free to post in the group. We will follow up with you.

Thanks very much for participating the community.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 18 '05 #7

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

Similar topics

3
3453
by: Xah Lee | last post by:
it would be good if Bash and Python have a decent logo. the current logos of simplistic font http://cnswww.cns.cwru.edu/~chet/img/bash-org.jpg http://python.org/pics/pythonHi.gif are homely. ...
15
3298
by: Albretch | last post by:
I am trying to design a "multilingual" logo. I was thinking about having a background graphic with two letters (the company name's accronym) on top of it. The thing is that (of course) the...
5
2110
by: Andrew Thompson | last post by:
I have a (rather challenged) css design for my site logo at http://www.lensescapes.com/tst/photologo.jsp It shows not only the current rendering of the design, but also has links to the CSS...
3
1988
by: Uffe Kousgaard | last post by:
I have been looking for a logo for the .NET framework similar to the Linux (the penguin) and java (cup of coffee) logo's. Not something like "I support .NET" or ".NET certified". Just a neutral...
4
2614
by: Xah Lee | last post by:
A Lambda Logo Tour (and why LISP languages using λ as logo should not be looked upon kindly) Xah Lee, 2002-02 Dear lispers, The lambda character λ, always struck a awe in me, as with...
2
1234
by: hazz | last post by:
Below is one row with a company logo in the left table cell and 'Reporting Tool' in the table cell on the right. I would like to add a button in this same row, just to the right of the company...
1
2315
by: ds26347 | last post by:
Hi everyone, I have been searching the web for about two hours trying to figure out how to add a load screen to media player. In my site I have the media player set to play when clicked which...
11
1540
by: Xah Lee | last post by:
recently on #emacs irc of freenode, there's a discussion of a logo of planet emacsen site. I made some comments about such logo: http://paste.lisp.org/display/28901 I have brought this...
1
1797
by: colmkav | last post by:
Hi, when I try to add a logo to my form I click on the unbounded object frame and then browse for tje location of my logo. I open the .bmp file but get an error claiming "OLE object isnt...
1
3124
by: timsamshuijzen | last post by:
The website I am developing is implemented as a Single Page Interface (SPI). During a visitor's session all new content gets loaded by JavaScript (Ajax), no new pages get loaded and the URL in the...
0
7260
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
7384
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
7539
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
7101
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
5686
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
5089
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
4746
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...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
456
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...

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.