Author |
Topic  |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 26 November 2003 : 07:37:00
|
I'm still only very new to .Net, but I'll hopefully be learning more in the next few weeks. For the time being, I have this important question to answer :
Is there anyway to mask the real name of an image in a directory (maybe using a number and treating the file list like an array) and at the same time to layer some text of the top of it ?
What I'm trying to achieve is a photo gallery - fill a directory with images and the .Net code automagically creates thumbnails on the fly (I have that code already) and when you click on the thumbnail the code displays the full image, with a watermark on it (to reduce copyright theft). The REAL file on disk is a completely clean image, but the user will NEVER see the real filename. Any ideas anyone ? |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 26 November 2003 : 08:58:22
|
quote: Originally posted by laser
What I'm trying to achieve is a photo gallery - fill a directory with images and the .Net code automagically creates thumbnails on the fly (I have that code already) and when you click on the thumbnail the code displays the full image, with a watermark on it (to reduce copyright theft). The REAL file on disk is a completely clean image, but the user will NEVER see the real filename. Any ideas anyone ?
This is exactly what I was planning before I had to remove the gallery due to bandwidth issues.
I presume you have the same code I used for the thumbnails whereby you pass the image filename to the aspx page via the querystring. When viewing the properties of the image the user will see http://www.yoursite.com/thumnailimage.aspx?file=photo.gif The user will never see the actual folder that the image is in because you can hardcode this in thumnailimage.aspx.
This is where I got up to when I implemented it, the user then clicked the image to display it full size with all the image path visible.
I was planning to implement my watermarked image the same way though eg http://www.yoursite.com/watermarkedimage.aspx?file=photo.gif
|
The UK MkIVs Forum |
Edited by - DavidRhodes on 26 November 2003 08:59:02 |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 26 November 2003 : 16:54:16
|
Where I'm at so far is : http://www.v8central.com/lfs/
although I have found that it's better to use JPGs as thumbnails as the images are TONS smaller - I knew that anyway, but the recommendation was GIFs.
This code just contains a raw link to the image, so the top one is amon_1.jpg, next image is bloke_4.jpg. I'm hoping to hide these image names, so people can SEE the thumbnail and the large version, but the not the real filenames |
 |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 27 November 2003 : 04:34:36
|
You seem to have got as far as I got then. What is the reason for not wanting to show the image name? Is it because you don't want them to link remotely from other sites? If so, just put the images in a folder that no-one will guess the name of and hardcode it into ShowThumbnail.aspx. |
The UK MkIVs Forum |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 05:00:27
|
I'm much more devious than that David 
Have a look at http://www.v8central.com/lfs/default2.aspx
A few reasons for doing it this way ...
- I'm sick of people stealing my images, not just remote linking - stealing with no credit - eliminates the need to have a thumbnail file and a large file - no need to spend time watermarking the image.
Now I can just dump a ton of images, almost direct from the camera and they are thumnailed & watermarked on the fly. MINIMAL work, MAXIMUM impact  |
 |
|
Nathan
Help Moderator
    
USA
7664 Posts |
|
laser
Advanced Member
    
Australia
3859 Posts |
|
DavidRhodes
Senior Member
   
United Kingdom
1222 Posts |
Posted - 27 November 2003 : 08:11:43
|
Have you got a code example for the watermark image? |
The UK MkIVs Forum |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 27 November 2003 : 16:11:18
|
I got some ideas/code from http://forum.snitz.com/forum/topic.asp?TOPIC_ID=35481&SearchTerms=text,over,image and from 4guys, but my current code looks a bit like this :
For Each s in Directory.GetFiles(Server.MapPath(IMAGE_DIRECTORY), "*.jpg")
' Create new image - bitmap
Dim objBMP as System.Drawing.Image = System.Drawing.Image.FromFile(s)
' Create a graphics object to work with from the BMP
objGraphics = System.Drawing.Graphics.FromImage(objBMP)
' Set anti-aliasing for text to make it better looking
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias
' Configure font to use for text
objFont = New Font("Arial Black", 16, FontStyle.Bold)
' Write out the text
objGraphics.DrawString("© www.HatiTech.com", objFont, Brushes.White, objBMP.Width/2, objBMP.Height/2)
' Set the content type and return the image
Response.ContentType = "image/Jpeg"
objBMP.Save(Response.OutputStream, ImageFormat.Jpeg)
objBMP.Dispose()
Next
Maybe not the best way or the cleanest code, but it works. |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 28 November 2003 : 01:53:55
|
I have three questions:
Is it possible to do paging, i.e. limit 10 pictures to be shown on a page and draw paging links if there are more than 10 files in a directory? Is it possible to draw the copyright tag at a specific place?
And does it means with this method of .net, one can not link to your files/images in their web pages? Is this an anti-leaching method?
|
Edited by - bjlt on 28 November 2003 01:58:15 |
 |
|
laser
Advanced Member
    
Australia
3859 Posts |
Posted - 28 November 2003 : 02:08:53
|
quote: Originally posted by bjlt
I have three questions:
Is it possible to do paging, i.e. limit 10 pictures to be shown on a page and draw paging links if there are more than 10 files in a directory?
I've done it before, but I haven't attempted it using .Net yet
quote:
Is it possible to draw the copyright tag at a specific place?
Yes, I specify the exact place. I did think of placing in a random location, but that defeats the whole purpose. You CAN choose font, size, location and text though.
quote:
And does it means with this method of .net, one can not link to your files/images in their web pages? Is this an anti-leaching method?
My aim was to stop people knowing the exact file name. They can still lift the branded image, but the file on disk doesn't have the branding at all. People can still steal images and remove the branding, but that means they have more work to do  |
 |
|
|
Topic  |
|