Hide email addresses from page Source

Hi,

I am working on some php code which specifies an image source as follows:

$img_name_path=“userpics/$useremail/”;

<img src=“$img_name_path”>

So, user email is being used in image source, now my problem is that i want to hide email addresses from page source, i tried using encryption methods, but, then images won’t appear.

Please suggest me a way to achieve this.

Thanks,
Kul.

You could hash the email addresses, but you’ll also have to hash the image file names too or add code to handle loading the image.

Yep, i tried hashing email addresses as well, but, then images don’t appear as src folder names get changed. and if i put hashing on image names too, then still one can view email addresses by viewing page source.

I wonder if there’s any way to hide email address from browser’s page source or not.

Are all the images the same type/extension? .jpg .gif for example.

Why shod the user’s a-mail be a part of the image’s source URL? You can use a user id instead.
I guess user details are stored in a database somehow.
You can create images as temporary files, and delete them later with a crontab(linux) job.
There are many ways to display a user’s image without exposing their details.

Yeah, i know that user’s email address shouldn’t be a part of image source, but, that is already done, the work that i need to do is to hide those email addresses from page source. But i am not able to find a way to achieve this.

Can you rename the images?

Yes, the images can be .jpg/.gif or of any image file extension.

if i rename the path/images the image source gets changed and images don’t appear.

Just wanted to hide or encode image path from browser, but, i don’t think there’s a way to do this.

I have a solution using the library “GD”.
I use a PHP program as the image’s source like in the following example:
<img src=“piccreate.php” />

Following is the “piccreate.php” program which displays a green rectangle:
<?php
header(“Content-type: image/png”);
$res=imagecreate(300, 500);
$green=imagecolorallocate($res, 0, 255, 0);
imagefill($res, 300, 500, $green);
imagepng($res);

?>

You can pass parameters to it, such as the image url encoded in base64.

Learn more about GD here.

Relying on JavaScript or images makes the information inaccessible to those who don’t have one or both of those.

For the email address to be accessible to those using web readers it needs to be plain text in the web page.

Also mailto: links only work when the visitor has an associated email program so that will not be usable to people using internet cafes, library computers etc.

The alternative is to take the email address out of the page completely by using a contact form and then adding the email address after the form is submitted.