php-general Digest 22 Nov 2007 15:05:38 -0000 Issue 5142

Topics (messages 264954 through 264964):

Re: Basic question - PHP usage of SVG files
        264954 by: Larry Garfield

image galleries
        264955 by: Lisa A
        264958 by: Colin Guthrie

Re: Should I put pictures into a database?
        264956 by: Lester Caine
        264957 by: Robert Cummings

getenv ... i think
        264959 by: Steven Macintyre
        264961 by: M. Sokolewicz
        264962 by: Per Jessen

imap_search - criterion "ON"
        264960 by: Max Frigge
        264963 by: Zoltán Németh

Re: Code Critique Please :)
        264964 by: Per Jessen

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Wednesday 21 November 2007, Dave M G wrote:
> Larry,
>
> Thank you for responding.
>
> > I think you missed the point.  SVG is just text. ... There's no need
> > for SVG support per se, as SimpleXML provides all you need anyway.
>
> I did miss the point - thanks for setting me straight.
>
> However, I'm still unsure about using SVGs. On the one hand, what I'm
> using as source files are originally in SVG format and I want to be able
> to dynamically resize and scale them without loss of clarity.

That sounds like an excellent reason to use SVG for your image manipulation.

> But, after they have been resized and scaled, then I think I need to
> send the resulting image to the browser in some raster image format.
> Indications are that SVG support on browsers is still not as uniform as
> PNG or other raster graphics formats.

Yeah, Firefox is the only browser I know of with native SVG support worth a 
damn.  Konqueror keeps talking about it but I don't know if it's any good 
yet.  Not sure about Opera or Safari.  IE requires a plugin from Adobe, which 
the last time I was playing with it (which has been a while, but there were 
no signs of plans to improve it at the time) was OK, but not great and 
embedded a la flash in a fixed, immutable box.

> At that last step, assuming that I have manipulated the images to my
> satisfaction with SimpleXML, can I then output the result in PNG or JPG
> with PHP?

With native PHP, I don't believe so.  However, I know that there are assorted 
command line tools and Java tools to do so.  I naturally can't think of them 
off the top of my head, but I know they exist.          You could exec() out to 
them 
to cache the rasterized combined image to disk and then serve that.

I don't know off hand if there's a PECL module or some user-space PHP code to 
do that.  It's worth spending 10 min Googling it, though.

> I'm not so sure this can be done. The tricky part is that I am building
> PHP scripts that could be deployed on servers with different PHP
> settings, so I'm not confident that I can rely on PEAR or ImageMagick
> functions being present. Are they standard on PHP > 5?

Now that could be a problem.  You'd have to find either some PHP user-space 
library or a CLI C library that you could bundle with the app.  I'm fairly 
certain nothing like that is in stock PHP 5.  As for finding a good such 
library, as I said Google would know better than I.  (Or maybe I should say 
Yahoo, since they use PHP. <g>)

> Forgive me if my questions are clueless to the point of making the
> questions unclear.

They make a lot more sense now, actually. :-)


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

--- End Message ---
--- Begin Message ---
Does anyone know of an image gallery I can use on multiple pages of a 
website.  I'd like to be able to click on the thumbnails and see a larger 
image.
Hopefully something simple and easy to install.
thanks,
Lisa A

--- End Message ---
--- Begin Message ---
Lisa A wrote:
> Does anyone know of an image gallery I can use on multiple pages of a 
> website.  I'd like to be able to click on the thumbnails and see a larger 
> image.
> Hopefully something simple and easy to install.

There is Gallery 2, http://gallery.menalto.com/ but that's a bit heavy
weight perhaps for your needs.

Something involving Lightbox or perhaps a JQuery based system woudl be
nice and lightweight fro the client end (they are javascript systems for
displaying larger images from thumbnails nicely) and just doing your own
lightweight PHP backend is a good soltuion.

Col

--- End Message ---
--- Begin Message ---
Michael McGlothlin wrote:
I use a custom file system that caches large amounts of data in RAM. That way it's really fast and as easy to use as normal file system calls.

It's called a relational database ;)
Seriously.
Databases like MySQL do not handle BLOB's with any sensible control hence the
againsts quoted. A decent database working in cooperation with the operating
system should be as fast at returning a block of raw data as searching the
file system to find the same block and hand that data to the following process
transparently.
Firebird has always handled BLOB's reasonably well, and with the incremental
backup facilities now available, ALL of the data can be safely managed and
replicated to secondary machines. Managing 100s of thousands of images in a
directory structure may not be the best way of managing a large volume of
data, requiring searching through a tree of directories to get to a file,
while storing the same in a flat file system WITHIN a database SHOULD be a
more efficient alternative.

Should I put pictures into a database? - depends on both the data base and the
file system/OS :)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://home.lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://home.lsces.co.uk
MEDW - http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
On Thu, 2007-11-22 at 06:22 +0000, Lester Caine wrote:
> Michael McGlothlin wrote:
> > I use a custom file system that caches large amounts of data in RAM.  
> > That way it's really fast and as easy to use as normal file system calls.
> 
> It's called a relational database ;)
> Seriously.
> Databases like MySQL do not handle BLOB's with any sensible control hence the
> againsts quoted. A decent database working in cooperation with the operating
> system should be as fast at returning a block of raw data as searching the
> file system to find the same block and hand that data to the following process
> transparently.
> Firebird has always handled BLOB's reasonably well, and with the incremental
> backup facilities now available, ALL of the data can be safely managed and
> replicated to secondary machines. Managing 100s of thousands of images in a
> directory structure may not be the best way of managing a large volume of
> data, requiring searching through a tree of directories to get to a file,
> while storing the same in a flat file system WITHIN a database SHOULD be a
> more efficient alternative.
> 
> Should I put pictures into a database? - depends on both the data base and the
> file system/OS :)

There's lots of reasons to do either. For one project I keep images in a
database. When the browser makes a request for the image via a specially
crafted URL it either gets a direct hit or invokes PHP's 404 handler.
Using the 404 handler I can then pull the image out of the database,
scale it's dimensions according to the URL and save to filesystem and
then set the header to status 200 and flush the image. using this
technique subsequent requests come from the file system while internally
I have the convenience of the database. Once a day I have a cron job
traverse the image version directory and purge any older than X days.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

--- End Message ---
--- Begin Message ---
Hi all,

http://steven.macintyre.name/myscript.phps

is my code as it stands 

The purpose of the code is as follows;

Its for a non-profit company - wanting to offer "support" banners for users
who pay for them right ... as in donation.

They want to be able to restrict those banners to a certain period "the
bought period" and I want to restrict them to only access the banners from
the specified URL when they signed up.

IE ... if you signed up with http://www.yourlovelydomain.com i want to be
able to limit the display of these banners depending on the hash and somehow
- checking the domain its coming from

Any ideas - am i on the right track ?

If i take OUT the getenv if then, it works ... so i know that is where the
problem is.

S

--- End Message ---
--- Begin Message ---
Steven Macintyre wrote:
Hi all,

http://steven.macintyre.name/myscript.phps

is my code as it stands
The purpose of the code is as follows;

Its for a non-profit company - wanting to offer "support" banners for users
who pay for them right ... as in donation.

They want to be able to restrict those banners to a certain period "the
bought period" and I want to restrict them to only access the banners from
the specified URL when they signed up.

IE ... if you signed up with http://www.yourlovelydomain.com i want to be
able to limit the display of these banners depending on the hash and somehow
- checking the domain its coming from

Any ideas - am i on the right track ?

If i take OUT the getenv if then, it works ... so i know that is where the
problem is.

S

First of all, be VERY MINDFUL of SQL-injection attacks. Right now your code is *very* vulnerable. Now, your problem is exactly as you stated: you don't get the data in the expected format. getenv ("REMOTE_HOST") is NOT the referrer. Furthermore, the referrer (which I don't recall what it is sent as exactly, as 'REFERER' I guess (usually gotten via $_SERVER or $_ENV, but getenv() should also work)) is not 'just' the domain name but also includes the path, so you have a huge chance that it won't be exactly what you expect it to be. Parse the url (parse_url() is your friend), extract the host and match against that.

- Tul

--- End Message ---
--- Begin Message ---
Steven Macintyre wrote:

> If i take OUT the getenv if then, it works ... so i know that is where
> the problem is.

I didnt bother with reading all your code, but maybe you should use
$_SERVER['REMOTE_HOST'] instead of the getenv() call ?


/Per Jessen, Zürich

--- End Message ---
--- Begin Message ---
Hey there,

i am trying to use the imap_search function oh PHP.
In the documentation it says i can use ON to search for
a date. Whenever i try that I get:

        "Unknown search criterion: ON"

Which is wired because ON is even mentioned in
the IMAP2 criteria?!?

Any ideas what's wrong?

Greets, Max

--- End Message ---
--- Begin Message ---
2007. 11. 22, csütörtök keltezéssel 21.15-kor Max Frigge ezt írta:
> Hey there,
> 
> i am trying to use the imap_search function oh PHP.
> In the documentation it says i can use ON to search for
> a date. Whenever i try that I get:
> 
>       "Unknown search criterion: ON"
> 
> Which is wired because ON is even mentioned in
> the IMAP2 criteria?!?

yep, ON is correct according to rfc3501 (IMAPv4rev1)

> 
> Any ideas what's wrong?

the problem is probably with the imap server. maybe it is not rfc
compliant or something.

greets
Zoltán Németh

> 
> Greets, Max
> 

--- End Message ---
--- Begin Message ---
Simeon F. Willbanks wrote:

> Hello,
> 
> I am trying to increase my knowledge and understanding of OO and OO
> Design Patterns.  I'd like to request a critique of a program that
> extracts MySQL table information and translates it into XML. 

You know that mysql has an output option for producing XML ?


/Per Jessen, Zürich

--- End Message ---

Reply via email to