473,385 Members | 1,387 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.

Image Q: built into browser/serving from read only directory

Not sure of best place for this question...
Are there any built in images within the browser that I can assume
(particularly IE and FF)?

More specifically, I am writing a one file webApp.php application which
needs one tiny little folder icon (e.g.
http://us.geo1.yimg.com/pic.geocitie...gr/folder.gif). Now
I could have a second file of the folder icon, but I would rather only
have one text file to distribute (namely, webApp.php). Of course, it
would be improper to reference a foreign website to get ahold of an
image each time. Therefore, if the browsers have some built in
standard images that I could access, it would be extremely helpful.

Somehow, I doubt it exists but I was bound to ask. So, here is an
alternate plan, failing that. I install the single webApp.php file.
When it is run, it checks for the existence of folder.gif in its own
directory and if it's not there, it creates the file itself (using data
embedded within webApp.php). The problem is that this doesn't cover
write protected directories (and I really want to avoid hitting a
remote server).

Now in Firefox it is possible to specify the actual bytes of an image.
In other words, I don't need to have
src="http://webAppDomain.com/image.jpg" but can do src="data:..."
(sorry if I've messed up on the details here). However, I don't think
IE supports this yet. That is why I've been casting about for an
alternate approach.

Ultimately, I can solve this problem by pointing the image's src to
"http://webAppDomain.com/webApp.php?getImage=folder" and have
webApp.php spit out the image in this case, but a simpler, more
straightforward solution would be preferred.

Thanks for any tips,
Csaba Gabor from Vienna

Nov 23 '05 #1
3 1469
Csaba Gabor wrote:
Ultimately, I can solve this problem by pointing the image's src to
"http://webAppDomain.com/webApp.php?getImage=folder" and have
webApp.php spit out the image in this case, but a simpler, more
straightforward solution would be preferred.


This question was a technology question, and not specific to any
particular one. Therefore, even though I don't have a client side
solution I'm happy with, in the absence of other replies, and in the
interest of at least one solution, I detail what works for me, though
it is PHP and not javascript. At the top of the webApp.php file I
have:

<?php
if ($_REQUEST && $imgName = $_REQUEST['sendImage'])
sendImage($imgName);

function sendImage($imgName) {
header("Content-type: image/gif");
$gif = "GIF89a\x0F\x00\x0D\x00\xA2\xFF\x00\xC0\xC0\xC 0" .
"\xFF\xFF\x00\xC0\xC0\xC0\x80\x80" .
"\x80\x00\x00\x00\x00\x00\x00\x00" .
"\x00\x00\x00\x00\x00\x21\xF9\x04" .
"\x01\x00\x00\x00\x00\x2C\x00\x00" .
"\x00\x00\x0F\x00\x0D\x00\x40\x03" .
"\x33\x08\x30\xCC\xFA\x6F\x80\x20" .
"\xA8\xAD\x75\x10\x79\x7B\x26\x00" .
"\x21\x8E\x24\x39\x60\x57\xD3\x2C" .
"\x13\xEA\x06\x1A\xF7\xA2\xDA\xE2" .
"\x4A\x90\x82\xE7\x79\x0C\xCC\xA9" .
"\xCD\xCF\x13\x94\x00\x31\x31\x95" .
"\x52\x45\x48\x00\x00\x3B";
$size = strlen($gif);
header("Content-Length: $size bytes");
print ($gif);
exit();
}
?>

One would call this like
<img src='http://webAppDomain/webApp.php?sendImage=folder'> Now it
might be that because the src is always the same, the image will be
cached and the server won't be hit again for subsequent requests. But
I forget whether or not that .php will cause the browser to ignore the
cache. If so, then what could be done is to replace that
webApp.php?sendImage=folder with folder.gif and have your Apache web
browser rewrite the folder.gif request to webApp.php?sendImage=folder.
Of course that steps outside the bounds of the original problem since
apache's httpd.conf file would be getting modified. Some further
comments on this approach to cacheing may be found at
http://php.net/imagecreatefrompng

Csaba Gabor from Vienna

Nov 23 '05 #2
VK

Csaba Gabor wrote:
Are there any built in images within the browser that I can assume
(particularly IE and FF)?
Yes and now - and in any case cannot be used :-)

Yes, any GUI browser uses some build-in images for its system screens
(and not only for that :-)

For example Firexox has a foxy globe:
chrome://browser/content/about.png

And IE has a bunch of little signs like
res://C:\WINDOWS\SYSTEM\SHDOCLC.DLL/pagerror.gif

Netscape 4.0x will show you the original Mozilla Little Dragon - but
with French baguette in his hand - if you type about:francais

And Him only knows what else is inside of things which are not made by
ourselves, but by rather young and often joyful people. By the way, did
you read yet The Book Of Mozilla? If not then this attractive reading
is waiting for you if you type about:mozilla in Firefox.

The "no" part of my answer is: these are all local system resources so
you cannot reach them if you page has been downloaded from a server.
Also the set and exact name/location of these pictures varies greatly
from one release to another.

Now in Firefox it is possible to specify the actual bytes of an image.
In other words, I don't need to have
src="http://webAppDomain.com/image.jpg" but can do src="data:..."
(sorry if I've messed up on the details here). However, I don't think
IE supports this yet.


"yet" is a wrong word here - we should say "still". Yes, any GUI
browser starting from NCSA Mosaic and including Internet Explorer
supports X Bitmap format - and pictures in this format can be generated
by JavaScript and inserted into <img>

So X Bitmap is totally universal solution (as long as JavaScript itself
is enabled) but this format supports only black'n'white pictures.

You may also consider VML and SVG vector graphics. VML is supported by
default by IE - but only by IE. SVG will be natively supported by
Firefox 1.5 but will require plugin right now.

Nov 23 '05 #3
On 2005-11-21, VK <sc**********@yahoo.com> wrote:
Now in Firefox it is possible to specify the actual bytes of an image.
In other words, I don't need to have
src="http://webAppDomain.com/image.jpg" but can do src="data:..."
(sorry if I've messed up on the details here). However, I don't think
IE supports this yet.


"yet" is a wrong word here - we should say "still". Yes, any GUI
browser starting from NCSA Mosaic and including Internet Explorer
supports X Bitmap format - and pictures in this format can be generated
by JavaScript and inserted into <img>

So X Bitmap is totally universal solution (as long as JavaScript itself
is enabled) but this format supports only black'n'white pictures.


Is there support for X Pixmap ? -
hmm xpm seems to be a rather complex format

it'd try it here but I'm running X so I'd not be sure it it was X or mozilla
rendering it.

MS-windows icon format is also supported on linux (for site icons) but
mozilla also supports other bitmaps up there (png, jpg, - even animated gifs)

Bye.
Jasen
Nov 23 '05 #4

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

Similar topics

1
by: GAR | last post by:
I recently set up ampache so I can have an mp3 server. I dont like how they display album covers so I decided to try and change it a little. Instead of taking the album cover from the mp3s...
23
by: Erik Schulp | last post by:
Hi all, I am using a background image via a stylsheet. I've used this code: background-image:url("/images/tile.gif"); (which I think is correct) The image doesn't show up however, the path,...
6
by: juglesh | last post by:
hello, here is my dir structure: /private mainaction.php img.jpg /public_html index.php in index.php, I include mainaction.php. In mainaction.php, i want to
0
by: Satish Appasani | last post by:
Hi: I have a ASP.NET form with Web layout which I've achieved using panels. In one of the tab I have a File control to upload Images. When I put a file in the file control and move to another...
17
by: santel_helvis | last post by:
Hi All, Could anyone tell me how to rotate the image in javascript. Which concepts I should concentrate to rotate the image
18
by: Auto | last post by:
Hello, I would like to know how do display an image into a Gridview (ASP.NET 2.0) taken directly from a DataBase, NOT using an URL, like described in this article: ...
1
by: KoRnDragon | last post by:
I need a Javascript function that will display X random images on a page that also doesn't display the same image twice. Bonus points if it grabs the max array from the folder and sets it. Even...
8
by: Alexander Fischer | last post by:
Hello, I am writing a gallery script and use imagecreatefromjpeg and fpassthru to output images without any change to them (i.e., no thumbnail creation etc. - just deliver the image via the php...
7
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Hi. I have an ASP.NET 2.0 web application which contains an Images directory with all website images. How can I prevent other websites from creating img tags with the source as my images? I want...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.