php-general Digest 24 Apr 2007 13:08:27 -0000 Issue 4753
Topics (messages 253552 through 253574):
filetype() and exec() issues
253552 by: dev.edoceo.com
253560 by: Tijnema !
253563 by: Buesching, Logan J
Re: retrieve POST body?
253553 by: Myron Turner
253557 by: Justin Frim
help needed to write an installation script for my php application
253554 by: guruswamy.gurusamy.wipro.com
253555 by: Ed Oceo
253564 by: Tijnema !
What determines the relative directory, and can I control it?
253556 by: Dave M G
253561 by: Tijnema !
253562 by: Buesching, Logan J
253565 by: Sancar Saran
Re: Find MAC Address in PHP
253558 by: Daevid Vincent
253574 by: Tijnema !
Re: Standard Address Book?
253559 by: Daevid Vincent
Re: advice for blob tables?
253566 by: Kevin Waterson
performance down
253567 by: dletz.blog.de
253568 by: Tijnema !
253573 by: Jochem Maas
voucher manipulation
253569 by: Steven Macintyre
253570 by: Tijnema !
253571 by: Jim Moseby
Re: Problems installing php with pdflib
253572 by: Tijnema !
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 ---
This question is a two parter....
a) anyone else noticing filetype() failing on ISO image files?
Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso
b) I have a script that during processing will eventually call
exec('/usr/bin/file -bi '.$file)
over 1000 times, I've added a counter and when it dies on this line it's
always after 1020 exec calls, regardless of the file name I'm feeding to
`file`. I've reproduced this with both exec, shell_exec, system and the
backticks. What am I missing here?
My System:
Linux carbon 2.6.18-gentoo-r3
PHP 5.2.1-pl3-gentoo (cli) (built: Apr 19 2007 00:42:03)
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
/djb
--- End Message ---
--- Begin Message ---
On 4/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
This question is a two parter....
a) anyone else noticing filetype() failing on ISO image files?
Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso
Nope, didn't fail for me. But what exactly do you want to know about
the file? filetype only check wheter the the argument given is a fifo,
char, dir, block, link, file, or unknown.
What you're doing below with the file command is getting the content
type, there you could use the function mime_content_type, but it is
deprecated, and seems not to work always. The manual forwards you to
the fileinfo functions:
http://www.php.net/manual/en/function.finfo-file.php
example 592 does what you're doing with the file command below.
b) I have a script that during processing will eventually call
exec('/usr/bin/file -bi '.$file)
over 1000 times, I've added a counter and when it dies on this line it's
always after 1020 exec calls, regardless of the file name I'm feeding to
`file`. I've reproduced this with both exec, shell_exec, system and the
backticks. What am I missing here?
Why does it die? Is it because te max execution time reached? then you
should extend the max executon time:
http://www.php.net/set_time_limit
Tijnema
<snip>
--- End Message ---
--- Begin Message ---
You may also want to check and make sure that your ISO isn't more than
4GB. IIRC, I had some troubles with extremely large files and using
filetype() on them. But then again, it may have just been something on
my own end.
-Logan
-----Original Message-----
From: Tijnema ! [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 24, 2007 2:18 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] filetype() and exec() issues
On 4/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> This question is a two parter....
>
> a) anyone else noticing filetype() failing on ISO image files?
>
> Warning: filetype(): Lstat failed for /var/lib/samba/some/file.iso
Nope, didn't fail for me. But what exactly do you want to know about
the file? filetype only check wheter the the argument given is a fifo,
char, dir, block, link, file, or unknown.
What you're doing below with the file command is getting the content
type, there you could use the function mime_content_type, but it is
deprecated, and seems not to work always. The manual forwards you to
the fileinfo functions:
http://www.php.net/manual/en/function.finfo-file.php
example 592 does what you're doing with the file command below.
>
> b) I have a script that during processing will eventually call
>
> exec('/usr/bin/file -bi '.$file)
>
> over 1000 times, I've added a counter and when it dies on this line
it's
> always after 1020 exec calls, regardless of the file name I'm feeding
to
> `file`. I've reproduced this with both exec, shell_exec, system and
the
> backticks. What am I missing here?
Why does it die? Is it because te max execution time reached? then you
should extend the max executon time:
http://www.php.net/set_time_limit
Tijnema
<snip>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Justin Frim wrote:
You are correct, I'm not very familiar with Perl.
If I do go the route of using something else to accept the form data
and then executing the PHP script, I'd be leaning more toward somehow
executing the PHP script directly rather then sending back a redirect
to the user-agent to re-send the request to the PHP script. Reason
being that if a file is uploaded, it ends up getting sent twice. For
a large file, that's a lot of extra HTTP traffic.
I'm not sure I follow here, because the Perl script would be saving the
posted file to disk. It would then send back a redirect with the name
of the file in the query string of the url, which would point to a php
script that would then read the file from the disk. So the file
shouldn't be sent more than once. In any event, I do think that at
least a few of use are agreed that somehow the whole post should be made
available in PHP.
Good luck with your solution,
Myron
_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/
--- End Message ---
--- Begin Message ---
Myron Turner wrote:
I'm not sure I follow here, because the Perl script would be saving
the posted file to disk. It would then send back a redirect with the
name of the file in the query string of the url, which would point to
a php script that would then read the file from the disk. So the file
shouldn't be sent more than once. In any event, I do think that at
least a few of use are agreed that somehow the whole post should be
made available in PHP.
Good luck with your solution,
Myron
Yes, you're right. :-)
Somehow I thought the whole request just goes twice.
I think I've been staring at a computer too long today. My head hurts. *L*
--- End Message ---
--- Begin Message ---
Hi There,
Could you please help me to write an installation script to install a
php based application in Windows.
1. I have WAMP5.0 running my my IBM T43 laptop.
2. I have created a php application.
3. I would like to know how to create an installation Wizard for my
application. What it should accomplish is that:
Once the CD containing my application is loaded to CD drive, it
should automatically ask me the standard windows installation questions
to install
my application in the path specified by me.
Your help will be highly appreciated.
Thanks,
G. Guruswamy (V&V, QCG)
+91-93412-74717
The information contained in this electronic message and any attachments to
this message are intended for the exclusive use of the addressee(s) and may
contain proprietary, confidential or privileged information. If you are not the
intended recipient, you should not disseminate, distribute or copy this e-mail.
Please notify the sender immediately and destroy all copies of this message and
any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should
check this email and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted by this
email.
www.wipro.com
--- End Message ---
--- Begin Message ---
On Mon, April 23, 2007 5:36 am, [EMAIL PROTECTED] wrote:
>
> Hi There,
>
> Could you please help me to write an installation script to install a
> php based application in Windows.
>
NSIS, nullsoft installer is a nice installer to use for Windows applications.
http://nsis.sourceforge.net/Main_Page
--
Edoceo, Inc.
http://www.edoceo.com/
--- End Message ---
--- Begin Message ---
On 4/23/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hi There,
Could you please help me to write an installation script to install a
php based application in Windows.
1. I have WAMP5.0 running my my IBM T43 laptop.
2. I have created a php application.
3. I would like to know how to create an installation Wizard for my
application. What it should accomplish is that:
Once the CD containing my application is loaded to CD drive, it
should automatically ask me the standard windows installation questions
to install
my application in the path specified by me.
Your help will be highly appreciated.
Thanks,
G. Guruswamy (V&V, QCG)
+91-93412-74717
Have a look at this page:
http://www.softpedia.com/get/Authoring-tools/Setup-creators/
It contains (nearly) all installer software, softpedia has a rating
system, so search for one with a high rating, and if you don't like
it, pick the second :)
Tijnema
--- End Message ---
--- Begin Message ---
PHP Users,
I am developing a content management system, and one of the goals is to
separate out the design entirely from the PHP scripting and content.
All the PHP scripts which contain the logic that drives the site are all
in the web site's root directory, where the main index.php is located.
The site uses an .htaccess file that creates "user friendly URLs", so
basically every time a user does anything on the site, it goes through
/index.php.
The intention is for the designer of the site to only have access to a
subdirectory of the site called "layout". If the designer wants, he or
she can have multiple styles, which would each be in their own
subdirectories. So, for example, there might be a /layout/styleOne
directory, and a /layout/styleTwo directory.
The way a designer builds a style is with a file called "layout.php".
This file contains blocks of HTML code that the designer can manipulate
in order to customize the layout of the site. For example, that file
would be located at /layout/styleOne/layout.php.
Right now, if the designer of the site wants to make a call to an
external CSS style sheet within layout.php, the designer has to write in
the whole path, relative to the index.php file. For example:
<style type="text/css">
@import "/layout/styleOne/style.css";
</style>
But I'd like to make it so that the designer doesn't need to ever think
about paths, and can state the path to the CSS file relative to
layout.php, and not relative to index.php. Like so:
<style type="text/css">
@import "style.css";
</style>
What happens is that index.php includes a file called include.php. That
file in turn includes all the PHP scripts on the site. That file
includes another file called Page.php which has a way of including
layout.php depending on what style the page needs. For example, styleOne
or styleTwo.
That's a long linear string of includes, but bottom line is, if I'm
correct, that the index.php ultimately includes layout.php, and
layout.php therefor acts as if it were in the same directory as index.php.
I hope I have described the situation adequately.
My question is, as implied above:
Can I somehow manipulate any of the PHP scripts involved so that the
HTML within layout.php will look first in it's own directory for
inclusion of files, such as CSS and javascript and anything else?
Thank you for your time and assistance.
--
Dave M G
Ubuntu 7.04 Feisty Fawn
Kernel 2.6.20-15-generic
Pentium D Dual Core Processor
--- End Message ---
--- Begin Message ---
On 4/24/07, Dave M G <[EMAIL PROTECTED]> wrote:
PHP Users,
I am developing a content management system, and one of the goals is to
separate out the design entirely from the PHP scripting and content.
All the PHP scripts which contain the logic that drives the site are all
in the web site's root directory, where the main index.php is located.
The site uses an .htaccess file that creates "user friendly URLs", so
basically every time a user does anything on the site, it goes through
/index.php.
The intention is for the designer of the site to only have access to a
subdirectory of the site called "layout". If the designer wants, he or
she can have multiple styles, which would each be in their own
subdirectories. So, for example, there might be a /layout/styleOne
directory, and a /layout/styleTwo directory.
The way a designer builds a style is with a file called "layout.php".
This file contains blocks of HTML code that the designer can manipulate
in order to customize the layout of the site. For example, that file
would be located at /layout/styleOne/layout.php.
Right now, if the designer of the site wants to make a call to an
external CSS style sheet within layout.php, the designer has to write in
the whole path, relative to the index.php file. For example:
<style type="text/css">
@import "/layout/styleOne/style.css";
</style>
But I'd like to make it so that the designer doesn't need to ever think
about paths, and can state the path to the CSS file relative to
layout.php, and not relative to index.php. Like so:
<style type="text/css">
@import "style.css";
</style>
What happens is that index.php includes a file called include.php. That
file in turn includes all the PHP scripts on the site. That file
includes another file called Page.php which has a way of including
layout.php depending on what style the page needs. For example, styleOne
or styleTwo.
That's a long linear string of includes, but bottom line is, if I'm
correct, that the index.php ultimately includes layout.php, and
layout.php therefor acts as if it were in the same directory as index.php.
I hope I have described the situation adequately.
My question is, as implied above:
Can I somehow manipulate any of the PHP scripts involved so that the
HTML within layout.php will look first in it's own directory for
inclusion of files, such as CSS and javascript and anything else?
Thank you for your time and assistance.
--
Dave M G
Ubuntu 7.04 Feisty Fawn
Kernel 2.6.20-15-generic
Pentium D Dual Core Processor
This is a client side problem. After your whole PHP processing has
been done, 1 final HTML page is executed. In that page you have set :
<style type="text/css">
@import "style.css";
</style>
Then the browser will create a NEW request, to get the style.css file.
And he will request that file in the same directory the index.php file
is in.
So what you want is impossible, unless you're gonna create a silly browser ;)
what you can do, and what i see a lot is that they let PHP open the
CSS file, and display the CSS inline.
Tijnema
--- End Message ---
--- Begin Message ---
[snip]
Can I somehow manipulate any of the PHP scripts involved so that the
HTML within layout.php will look first in it's own directory for
inclusion of files, such as CSS and javascript and anything else?
[/snip]
If a user accesses http://site.com/index.php, then the HTML that is spit
back out from requesting index.php better have CSS import statements
that point to where the CSS files really are.
Example:
Requesting http://site.com/index.php returns
<script type="text/css">
@import a.css
</script>
Then there better be the following:
http://site.com/a.css
There is no way around that (AFAIK), because that is how the web
browsers find such CSS sheets. In a simplified explanation, they look
for the path of the import, append it to where the request was filed,
and download whatever they get.
You can make it easier on the designer though, in by telling them they
must do something like:
<script type="text/css">
@import $path.'a.css'
</script>
Then YOUR php files can determine whatever $path needs to be before it
includes the file.
So when they request http://site.com/index.php, it will spit out:
<script type="text/css">
@import styles/site1/a.css
</script>
I hope this makes sense.
-Logan
--- End Message ---
--- Begin Message ---
Greetings.
On Tuesday 24 April 2007 09:22, Tijnema ! wrote:
> > Right now, if the designer of the site wants to make a call to an
> > external CSS style sheet within layout.php, the designer has to write in
> > the whole path, relative to the index.php file. For example:
> > <style type="text/css">
> > @import "/layout/styleOne/style.css";
> > </style>
> >
> > But I'd like to make it so that the designer doesn't need to ever think
> > about paths, and can state the path to the CSS file relative to
> > layout.php, and not relative to index.php. Like so:
> > <style type="text/css">
> > @import "style.css";
> > </style>
> >
> > What happens is that index.php includes a file called include.php. That
> > file in turn includes all the PHP scripts on the site. That file
> > includes another file called Page.php which has a way of including
> > layout.php depending on what style the page needs. For example, styleOne
> > or styleTwo.
> >
> > That's a long linear string of includes, but bottom line is, if I'm
> > correct, that the index.php ultimately includes layout.php, and
> > layout.php therefor acts as if it were in the same directory as
> > index.php.
> >
> > I hope I have described the situation adequately.
> >
> > My question is, as implied above:
> >
> > Can I somehow manipulate any of the PHP scripts involved so that the
> > HTML within layout.php will look first in it's own directory for
> > inclusion of files, such as CSS and javascript and anything else?
> >
> > Thank you for your time and assistance.
> > Dave M G
> > Ubuntu 7.04 Feisty Fawn
> > Kernel 2.6.20-15-generic
> > Pentium D Dual Core Processor
function getCss($styleName)
{
$strReturn = "<style
type='text/css'>@import '/layout/"._MY_LAYOUT_DIR_."/".styleName."';</style>
return $strReturn;
}
layout.php
<?php
define("_MY_LAYOUT_DIR_","styleOne");
// when css file need use
getCss('style.css')
?>
And if you ask me for options. Kick designers until the they get learn
someting about directory.... This kind of "auto magic" operations bloats
scripts, increases CPU costs and increases security threads (because you
assume lots of things and because of murph law your assumptations have to
false)
Also you cannot satisfy designers until generate some kind of mind reader
device/software to automaticly convert their dreams into perfect html/php
code. Even you invent that thing they will still complaing about no body
understand their ability of art.
So kick them hard as possible...
Regards
Sancar
--- End Message ---
--- Begin Message ---
This may help you (find .tgz file at the page bottom):
http://daevid.com/examples/dhcp/
This is a little web tool I use to see who is on my LAN
D.Vin
> -----Original Message-----
> From: Nathaniel Hall [mailto:[EMAIL PROTECTED]
> Sent: Friday, April 20, 2007 1:00 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] Find MAC Address in PHP
>
> Hi all,
>
> I am attempting to find the MAC address of systems visiting
> my page from
> the local LAN. I have tried several things, but it appears
> it will not
> let me run system commands. For example, running <?php $MAC =
> system("arp 192.168.200.254"); echo $MAC; ?>" does not give me any
> output. I have copied arp to a place that the apache user
> can execute
> from and ensured arp is executable.
>
> This is on a Fedora Core 6 box running PHP 5.1.6-3.4 and Apache
> 2.2.3-5. Any help is appreciated.
>
> --
> Nathaniel Hall
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
On 4/23/07, Davi <[EMAIL PROTECTED]> wrote:
Em Domingo 22 Abril 2007 03:12, Richard Lynch escreveu:
> On Fri, April 20, 2007 3:00 pm, Nathaniel Hall wrote:
> > <?php $MAC = system("arp 192.168.200.254"); echo $MAC; ?>
> > does not give me any
> > output. I have copied arp to a place that the apache user can execute
> > from and ensured arp is executable.
>
> Use exec and the extra args to get error codes.
ARP is a root-command... =]
Ok, maybe it's because i've builded my own Linux, and didn't wanted to
have any security, but /sbin/arp has chmod value 755 on my system, and
so, i can execute it with any user.
>
> Can you run 'arp' and get what you want from command line?
As web-user? No.
i can :)
>
> Can you 'su' to PHP user and *then* run it and get what you want?
Hum... Not at all... You need to enter the root password... How can you do
that?
sudo sounds a little better... But... How about security?
Hmm, that would mean that you have to store your root password in your
PHP script ... I don't prefer that, maybe you could use it on a
development server, but don't use it on production server ;)
>
> If not, you can't do that.
And with a shell-script outputting the MAC to a .txt temp file, reading it
from the PHP script?
BTW, have a look at suPHP [1]... =]
[1] - http://www.howtoforge.com/suphp_debian_etch_ispconfig
That's really a big job to install :(
Tijnema
--- End Message ---
--- Begin Message ---
You might look into vCards -- most mail clients load/import them.
http://en.wikipedia.org/wiki/VCard
> -----Original Message-----
> From: Jim Lucas [mailto:[EMAIL PROTECTED]
> Sent: Monday, April 23, 2007 8:48 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Standard Address Book?
>
> Timothy Murphy wrote:
> > Is there any kind of standard
> > for a PHP/SQL/XML addressbook?
> >
> Are you asking if there is any type of standard for building
> an address book in general?
>
> That you are using PHP/SQL/XML is your preference.
>
> With a few clicks from Google, I found these:
> http://groupware.openoffice.org/ab_schema/index.html
> http://developer.apple.com/documentation/AppleApplications/Ref
> erence/SyncServicesSchemaRef/Articles/Contacts.html
>
> Hope this helps
>
> --
> Enjoy,
>
> Jim Lucas
>
> Different eyes see different things. Different hearts beat on
> different strings. But there are times
> for you and me when all such things agree.
>
> - Rush
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
This one time, at band camp, [EMAIL PROTECTED] wrote:
> I've been using this one:
>
> http://www.dreamwerx.net/phpforum/?id=1
>
> I developed it in 2001 and it's had implementations into the hundreds of
> gb's so far. I have a ftp interface to it that runs at wire speed
> (100FDX). I initially did it the 1 row way, and ran into issues, so I
> implemented this one.
Thats fine, but this is normalization for no real purpose.
You have defined two tables, one for the image and another for the metadata
but the relationship is one-to-one which makes it rather redundant except if
you wish to store different amounts of metadata per image.
You also state
"How about NFS/SMB network shares? That's not a bad idea either but not without
it's problems"
Whilst I am an advocate of binary storage, there is no real issue I see with
NFS/SMB particularly
NFSv4 (supports file locking which I like) or GFS2.
Cluster file system works quite well.. but I digress.
I find all sorts of injection issues surrounding statements such as
$SQL = "select * from file where id = " . $_GET["id"]
in the tutorial you mention, not that this is a production ready script, it
just makes me
nervouse when newbies replicate this.
Kind regards
kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."
--- End Message ---
--- Begin Message ---
Hello everyone,
recently we tested upgrading our systems from:
apache 2.0.55
php 5.1.6
eacclerator 0.9.5
to:
apache 2.2.3
php 5.2.0
eaccelerator 0.9.5
but we always get worse performance than before. So maybe it is the newer
apache version which slows us down or changes in php 5.2.0.
Has anyone come across a similar phenomenon?
Dominic Letz
--- End Message ---
--- Begin Message ---
On 4/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello everyone,
recently we tested upgrading our systems from:
apache 2.0.55
php 5.1.6
eacclerator 0.9.5
to:
apache 2.2.3
php 5.2.0
eaccelerator 0.9.5
but we always get worse performance than before. So maybe it is the newer
apache version which slows us down or changes in php 5.2.0.
Has anyone come across a similar phenomenon?
Dominic Letz
What platform are you using? Windows or Linux?
Never had any slow PHP versions on my Linux server.
Tijnema
--- End Message ---
--- Begin Message ---
Tijnema ! wrote:
> On 4/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> Hello everyone,
>>
>> recently we tested upgrading our systems from:
>> apache 2.0.55
>> php 5.1.6
>> eacclerator 0.9.5
>> to:
>> apache 2.2.3
>> php 5.2.0
>> eaccelerator 0.9.5
>>
>> but we always get worse performance than before. So maybe it is the newer
>> apache version which slows us down or changes in php 5.2.0.
>> Has anyone come across a similar phenomenon?
>>
>>
>> Dominic Letz
>
>
> What platform are you using? Windows or Linux?
>
> Never had any slow PHP versions on my Linux server.
**SLOWER** it's a comparative not an absolute. know the difference.
either go back to comparing print & echo or realise that (for example)
a spaceshuttle is fast and an F1 racecar is fast but one if *faster* than the
other.
the OP asked about comparative performance degradation.
sorry OP I can't comment on the degradation your seeing, but I'm
interested if anyone can - in the mean time you might consider downgrading
apache
and measuring the difference and subsequently upgrading apache whilst
downgrading php and measuring
the difference also - it might give you a clue as to which beast is causing the
problem. you might also consider that it's not the upgrade as such but the
server
configuration (for apache mostly) that is sub optimal.
>
> Tijnema
>
--- End Message ---
--- Begin Message ---
Alo,
I have a client looking to do the following;
There is a standard "voucher" design, in the format of JPG ... now ... they
wish to create a voucher system where if you reach so many points etc you
can claim a voucher (using the design) with a expiry date ... current +
30days and a unique voucher number.
Now, I have looked at ImageCreateFromjpeg etc ... but ... cant figure out
how to place the text on it within the specified areas. It will then be
emailed to the user.
Does anyone know of an idea out there already I can take a look at ... or
some advice?
Kind regards,
Steven Macintyre
--- End Message ---
--- Begin Message ---
On 4/24/07, Steven Macintyre <[EMAIL PROTECTED]> wrote:
Alo,
I have a client looking to do the following;
There is a standard "voucher" design, in the format of JPG ... now ... they
wish to create a voucher system where if you reach so many points etc you
can claim a voucher (using the design) with a expiry date ... current +
30days and a unique voucher number.
Now, I have looked at ImageCreateFromjpeg etc ... but ... cant figure out
how to place the text on it within the specified areas. It will then be
emailed to the user.
Does anyone know of an idea out there already I can take a look at ... or
some advice?
Kind regards,
Steven Macintyre
You're at the right start, you should create a image stream with
ImageCreateFromJpeg, and then you should write text to it with one of
the following functions:
ImageTtfText
ImagePsText
ImageFtText
and then save it, or output it. (ImageJpeg for example)
Tijnema
--- End Message ---
--- Begin Message ---
>
> Alo,
>
> I have a client looking to do the following;
>
> There is a standard "voucher" design, in the format of JPG
> ... now ... they
> wish to create a voucher system where if you reach so many
> points etc you
> can claim a voucher (using the design) with a expiry date ...
> current +
> 30days and a unique voucher number.
>
> Now, I have looked at ImageCreateFromjpeg etc ... but ...
> cant figure out
> how to place the text on it within the specified areas. It
> will then be
> emailed to the user.
>
> Does anyone know of an idea out there already I can take a
> look at ... or
> some advice?
>
Steven,
Have a look at http://php.net/imagettftext . Also, here is a code snippet
from something I did a long time ago to brand uploaded images. Maybe you
can modify it for your needs or get an idea of how to proceed. It contains
two slightly offset imagettftext() calls because I wanted a "drop shadow"
effect to the brand.
-------------[code]---------------
$fontpath =$_SERVER['DOCUMENT_ROOT']."/PAPYRUS.TTF";
function brand_image($big_pic){
// Draw border and brand big_pic
$ims=getimagesize($big_pic);
$img = ImageCreateTrueColor($ims[0],$ims[1]);
$black = imagecolorallocate ($img, 0, 0, 0);
$white = imagecolorallocate ($img, 255, 255, 255);
imagecopy($img,$org_img, 0, 0, 0, 0, $ims[0], $ims[1]);
for($x=0;$x<$tnborderwidth;$x++){imagerectangle($img,$x,$x,$ims[0]-(1+$x),$i
ms[1]-(1+$x), $black);}
imagettftext($img,20, 0, $ims[0]-260, $ims[1]-20, $black, $fontpath,
$brandtext);
imagettftext($img,20, 0, $ims[0]-262, $ims[1]-22, $white, $fontpath,
$brandtext);
imagejpeg($img,$big_pic,90);
imagedestroy($img);
} //function brand_image
--------------[/code]---------------
JM
--- End Message ---
--- Begin Message ---
On 4/17/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
On Sat, April 14, 2007 3:55 am, Merlin wrote:
> I am moving to a new box and want to install php with pdflib again.
> After configure I get an error saying:
> pdflib.h not found! Check the path passed to --with-pdflib
>
> The path is just fine:
> '--with-pdflib=/usr/local/lib'
configure needs to find TWO things:
#1 the "lib" file which is libpdf.so in /usr/local/lib
#2 the "header" file which is libpdf.h in /usr/local/include
If you tell configure to look inside of /usr/local/lib, it can't
*find* the libpdf.h file, because it's not inside that directory, it's
inside a directory parallel to that.
If you tell configure to look in /usr/local, it "knows" to check in
/usr/local/lib for the .so file, and in /usr/local/include for the .h
file, and it finds everything it needs.
It won't, because his headers are in /usr/local/lib, and not in
/usr/include/header
I don't know if the following will work, but you could try adding the
an include dir to CFLAGS:
export CFLAGS="-I /usr/local/lib"
*note that this will destroy currently set CFLAGS.
And then try configuring with --with-pdflib=/usr/local
Tijnema
--- End Message ---