using client side images?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

using client side images?

Post by Coco »

Doubtless this has been asked before (i tried phuse but it didnt come up with anything useful)

What i want to be able to do is to allow users to download a graphics pack (with the aim of saving on longterm bandwidth)
Obviously tho, my scripts need to be able to access these graphics. So, is it possible to access client stored images? if so how?
(i only want to access them for html, the script itself wont access them for any other purpose)
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Not possible.

Instead of trying to save images to the user's hdd, what would stop one from saving a virus to the user's hdd. Security. :)
Image Image
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

yeah but i thought it wasnt possible to have viruses in jpeg and gif type files?

im not saying the script itself saves the images there, the user does that, what i want to do is to read the images, nothing else
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

if you could get people to put the images in the same place - or had a bit on your site where they could say where they put them and you stored a cookie with that info - then you could have your image paths changed to things like C:\cocos_images\ to grab them off the local machine.

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

many browser-games do so. The local path is stored along with the account-informations and the user has to enter the path.
remember: it's not the script that displays the images, it's the client (browser). The html-document (generated by the script) only has to tell the client where it can find the images.
Make sure users can change these settings even if they've entered the wrong path previously (pure graphical navigation isn't helpful at this state ;) )
Coco
Forum Contributor
Posts: 339
Joined: Sat Sep 07, 2002 5:28 am
Location: Leeds, UK
Contact:

Post by Coco »

great :)
so i can just use file paths like windows does when its using IE in explorer mode?

and funnily enough, it is for a browser game :P
im intending to make a php version of master of orion 2... and then build on it from there til i have something thats not liable to copyright infringement
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

the local filesystem can be accessed via file:///<path>
let's say you have a graphic pack like
  • graphics/
    • background/
      • main.png
      • ...
    • monster/
      • beholder.png
      • ...
    • ...
now you fetch the account infos and check wether the user has entered a local path

Code: Select all

<?php
$info = getUserAccountInfo(); // whatever this is
if (!isset($info['path']))
	$info['path'] = 'http://my.ho.st/data';
// supposed to be something like file:///C:/brwosergame1 if set
...
?>
...
<img src="<?php echo $info['path']; ?>/graphics/monster/beholder.png" alt="a beholder" />
...
But you cannot check wether the path is correct. If not, the user will see no graphics. Therefor do not forget the alt-property and do anything to keep a minimal navigiation working in case the user fails...
Post Reply