I want to store frequently-used graphic elements in a db and serve
them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking
etc not shown)
The relevant piece of the page:
<?php
echo
'<table><tr><td >
<img src="ImageFromD B.php?Image=Ima geIdentifer">
</td></tr></table>' ;
?>
ImageFromDB.php :
<?php
$imgname = $_GET['Image'] ;
$dset = mysql_query( 'SELECT imagebits FROM graphics_table
WHERE name="' . $imgname . '"' ) ;
$rec = mysql_fetch_row ($dset) ;
$browser = fopen( 'php://output', 'w') ;
header( 'Content-Type: image/png' ) ;
fwrite( $browser, $rec[0] ) ;
?>
I fingered through the docs and did some googling, but didn't find
anything obviously helpful. Many thanks for any insights.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.) 13 1906
"Margaret MacDonald" wrote: I want to store frequently-used graphic elements in a db and serve them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking etc not shown)
The relevant piece of the page: <?php echo ’<table><tr><td > <img src="ImageFromD B.php?Image=Ima geIdentifer"> </td></tr></table>’ ; ?>
ImageFromDB.php : <?php $imgname = $_GET[’Image’] ; $dset = mysql_query( ’SELECT imagebits FROM graphics_table WHERE name="’ . $imgname . ’"’ ) ; $rec = mysql_fetch_row ($dset) ; $browser = fopen( ’php://output’, ’w’) ; header( ’Content-Type: image/png’ ) ; fwrite( $browser, $rec[0] ) ; ?>
I fingered through the docs and did some googling, but didn’t find anything obviously helpful. Many thanks for any insights.
Margaret
Margaret, your script and db are going thru a lot of processing just
to serve frequently used images. Why not save them on disk, and put
their path (or file name) in the db. Is there an important reason
to save them to db?
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Serving-...ict139672.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=467181
steve wrote: "Margaret MacDonald" wrote: I want to store frequently-used graphic elements in a db and serve them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking etc not shown)
The relevant piece of the page: <?php echo ’<table><tr><td > <img src="ImageFromD B.php?Image=Ima geIdentifer"> </td></tr></table>’ ; ?>
ImageFromDB.php : <?php $imgname = $_GET[’Image’] ; $dset = mysql_query( ’SELECT imagebits FROM graphics_table WHERE name="’ . $imgname . ’"’ ) ; $rec = mysql_fetch_row ($dset) ; $browser = fopen( ’php://output’, ’w’) ; header( ’Content-Type: image/png’ ) ; fwrite( $browser, $rec[0] ) ; ?>
I fingered through the docs and did some googling, but didn’t find anything obviously helpful. Many thanks for any insights.
Margaret
Margaret, your script and db are going thru a lot of processing just to serve frequently used images. Why not save them on disk, and put their path (or file name) in the db. Is there an important reason to save them to db?
Mainly as a security thing, Steve. The people for whom I'm doing this
project expect relentless attacks to be made on their site (I suspect
that they're probably right) so my goal is to make the whole thing as
seamless and opaque as I possibly can.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
I wrote: ... my goal is to make the whole thing as seamless and opaque as I possibly can.
That should have been 'as I possibly can consistent with usable
performance'.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
"Margaret MacDonald" wrote: I wrote:... my goal is to make the whole thing as seamless and opaque as I possibly can.
That should have been ’as I possibly can consistent with usable performance’.
Margaret
Margaret, are you talking about stopping leeching, i.e. people linking
to these images. If that is the case, there are many other solutions.
Check for "anti-leeching" on search engines.
-- http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Serving-...ict139672.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=467277
steve wrote: "Margaret MacDonald" wrote: I wrote:... my goal is to make the whole thing as seamless and opaque as I possibly can.
That should have been ’as I possibly can consistent with usable performance’.
Margaret
Margaret, are you talking about stopping leeching, i.e. people linking to these images. If that is the case, there are many other solutions. Check for "anti-leeching" on search engines.
No, actually I don't care about that, Steve--they can always grab the
image from the screen if that's what they want. My purpose is to
frustrate the ones who will be trying to collect information as a
prelude to and tool for breaking in. If they can't learn the
filesystem structure or filenames, it becomes that much harder for
them to attack the system.
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.)
On Sat, 14 Aug 2004 13:28:17 GMT, Margaret MacDonald
<sc**********@a tt.not.invalid> wrote: I want to store frequently-used graphic elements in a db and serve them from there rather than from the filesystem.
Is there a better/faster way to do that than this? (error checking etc not shown)
The relevant piece of the page: <?php echo '<table><tr><td > <img src="ImageFromD B.php?Image=Ima geIdentifer"> </td></tr></table>' ; ?>
ImageFromDB.ph p: <?php $imgname = $_GET['Image'] ; $dset = mysql_query( 'SELECT imagebits FROM graphics_table WHERE name="' . $imgname . '"' ) ; $rec = mysql_fetch_row ($dset) ; $browser = fopen( 'php://output', 'w') ; header( 'Content-Type: image/png' ) ; fwrite( $browser, $rec[0] ) ; ?>
I fingered through the docs and did some googling, but didn't find anything obviously helpful. Many thanks for any insights.
Looks OK to me. A plain 'print' would likely do just as well as opening the
output stream as you've done, but there's nothing wrong with that. You might
want to change the mode to 'wb' though to indicate binary mode.
If these images are frequently accessed then it might be worth considering
using a filesystem-based cache if the database queries take noticable amounts
of resources.
General opinion on this group is to not store images in a database and instead
just store a filesystem path. However, I believe that if the images are
(a) user data rather than static source code of the site
(b) have relationships with data in the database
(c) have any sort of value with regards to the end-user
... then it's worth considering storing them in full in the database so you
can include them consistently in the database backups, and have the same
transaction guarantees as all the other data on them.
--
Andy Hassall / <an**@andyh.co. uk> / <http://www.andyh.co.uk >
<http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool
"Margaret MacDonald" wrote: steve wrote:
"Margaret MacDonald" wrote: I wrote: >... my goal is to make the whole thing as >seamless and opaque as I possibly can.
That should have been ’as I possibly can consistent with usable performance’.
Margaret
Margaret, are you talking about stopping leeching, i.e. people linkingto these images. If that is the case, there are many other solutions. Check for "anti-leeching" on search engines.
No, actually I don’t care about that, Steve--they can always grab the image from the screen if that’s what they want. My purpose is to frustrate the ones who will be trying to collect information as a prelude to and tool for breaking in. If they can’t learn the filesystem structure or filenames, it becomes that much harder for them to attack the system.
Margaret
oh, I see. Sorry if I have taken the thread off-track (?). In any
case, you can always mask the file system with php. No need to pull
from db, same effect. Ok, sorry again.
"Margaret MacDonald" <sc**********@a tt.not.invalid> wrote in message
news:uc******** *************** *********@4ax.c om... steve wrote:
"Margaret MacDonald" wrote: I wrote: >... my goal is to make the whole thing as >seamless and opaque as I possibly can.
That should have been 'as I possibly can consistent with usable performance'.
Margaret
Margaret, are you talking about stopping leeching, i.e. people linking to these images. If that is the case, there are many other solutions. Check for "anti-leeching" on search engines.
No, actually I don't care about that, Steve--they can always grab the image from the screen if that's what they want. My purpose is to frustrate the ones who will be trying to collect information as a prelude to and tool for breaking in. If they can't learn the filesystem structure or filenames, it becomes that much harder for them to attack the system.
Apache rewrite is probably a better solution here.
steve wrote: Margaret, are you talking about stopping leeching, i.e. people linkingto these images. If that is the case, there are many other solutions. Check for "anti-leeching" on search engines.
No, actually I don’t care about that, Steve--they can always grab the image from the screen if that’s what they want. My purpose is to frustrate the ones who will be trying to collect information as a prelude to and tool for breaking in. If they can’t learn the filesystem structure or filenames, it becomes that much harder for them to attack the system.
Margaret
oh, I see. Sorry if I have taken the thread off-track (?). In any case, you can always mask the file system with php. No need to pull from db, same effect. Ok, sorry again.
No, actually I'm glad you brought up leeching, Steve, so: thanks! As
you can tell from my response to you, I misunderstood what you meant
(I hadn't heard the term 'leeching' in this context before). Yes, I
can now see that preventing leeching will be an issue as well. My
problem is that web development is a completely new thing for me--my
experience has all been with shrinkwrap and systems software--so there
are plenty factors that simply don't occur to me til someone else
brings them up--usually by accident :-)
Margaret
--
(To mail me, please change .not.invalid to .net, first.
Apologies for the inconvenience.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: -[ CaMeL ]- a55m0nk |
last post by:
Hi there
i am creating a clan website in ASP and am making a page serving
script
a link sends a query to the default page and then serves the page by
grabbing the HTML from a database that refers to the pageID.
this works like a peach whenever the page is just HTML
e.g. http://www.deathworld.net/camel2.0/default.asp?id=2
|
by: David W. Fenton |
last post by:
I have an app for a client (Access97, all the final service releases
and Jet service packs, full installation (not runtime)), that
displays a graphic in an image control based on a path/filename
stored in a field in a data table. It works just great on my PC for
BMP, GIF and JPG.
But on the client's PC, JPG doesn't work (dunno if GIF works or not
-- didn't try it; BMP does work).
I wrote to Larry about this and he hasn't any...
|
by: Martin |
last post by:
I am using graphics as backgrounds for forms,buttons,labels etc.
The question is: is it faster to load all graphics from files on app start
or
to use it embeded (places in editor during design).
Reason for my question is that application has 5mb, while without graphics
it has cca 400kb.
Graphic files (bmps) take about 200kb (in program, they are repeated many
times, ie almost all labels (around 200) have same background image)).
Also,...
|
by: Peter Morris [Droopy eyes software] |
last post by:
Hi all
Instead of a url like so
http://www.howtodothings.com/viewarticle.aspx?id=1
I'd like to do this
http://www.howtodothings.com/articles/computers/dotnet/aspdotnet/001.html
|
by: Al |
last post by:
Hi,
I am trying to Save a RTF that contains graphics to SQL
server. Doesn't anyone know a VB code to do that?
Thanks
Al
| |
by: SStory |
last post by:
I need to be able to give the appearance of glass over a picture inside of a
frame.
How can I do this in real time given that the picture will change?
Is there a way using the graphics to make it look like the picture has glass
in front of it?
Thanks,
|
by: Carlos Ojea Castro |
last post by:
Hello:
I want to display graphics from my postgresql database, but I must
choose the proper tool first.
Which one is more suitable?:
perl?
php?
pg_autodoc?
another one?
|
by: Csaba Gabor |
last post by:
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.geocities.com/img/filemgr/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,...
|
by: Siv |
last post by:
Hi,
A little while ago I wrote a small program that allowed the user to view
products from a database. The database holds the details of the products
which can be viewed via a form and additionally pictures of the product are
stored in an images subfolder and the database holds the file name of the
relevant picture. The user can then click a button to display the picture in
a pop-up window and also another button to email the potential...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |