[PHP] Possible bug with imagettftext and imageft text when imagealphablending is false

2005-10-12 Thread Ethilien
I have been attempting to write a dynamic text replacement script that 
would generate transparent PNGs using gd, and it works fine except when 
one of the characters in a font has parts of it that overhang into the 
previous characters. You can see what I mean in this test script:


?php
$img = imagecreatetruecolor(200, 200);
imagealphablending($img, false);
$trans = imagecolortransparent($img);
imagefilledrectangle($img, 0, 0, 400, 400, $trans);
$green = imagecolorallocate($img, 6, 68, 0);
imagettftext($img, 30, 0, 10, 50, $green, carolingia.ttf, Linux);
header(Content-type: image/png);
imagesavealpha($img, true);
imagepng($img);
imagedestroy($img);
?

The result can be seen at http://ethilien.net/tests/text.php
When you compare the text with what it should look like when I comment 
out the imagealphablending($img, false); line here 
http://ethilien.net/tests/text2.php you can see that the end of the 'u' 
is cut off.


I think that this is because the lower-left slash of the 'x' overlaps it 
and causes it to be overwritten.


This might be a bug in GD and not PHP, but I wanted to see if anyone has 
encountered this problem before or if I'm just not doing something right.


Thanks,

-Connor McKay

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



[PHP] Re: array_slice and for loop problem

2005-10-12 Thread Ethilien
Are you trying to put each return from array_slice into $output as an 
array? You need to replace $output = array_slice... with $output[] = 
array_slice...


Also, you cannot just echo an array (even of characters). It must be a 
string, or else echo will only produce the output 'Array'.


Hope this helps,
-Connor McKay

Rodney Green wrote:

Hello,

I'm using a for loop to iterate through an array and slice parts of
the array and add into another array.

When array_slice is called the variable $i is not being substituted
with the current value of
$i and the $output array is empty after running the script. Can
someone look at the code below and give me a clue as to why this
substitution is not happening? If I uncomment the echo $i; statement
the value of $i is printed just fine.

Thanks,
Rod

Here's my code:


$number = count ($int_range[start]);
   //echo $number;
   for ($i = 0; $i = $number; $i++) {

  //echo $i;

   $output = array_slice ($textArray, $int_range[start][$i],
$int_range[end][$i]);

   }




   foreach ($output as $value) {

  echo $value;
}


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



[PHP] Re: How can I connect a remote server from phpmyadmin?

2005-10-12 Thread Ethilien
You need to edit the config.inc.php file in the phpmyadmin directory and 
set the appropriate server address/username/password information for 
your remote server. You might have to set a remote server up in cpanel 
for this to work however.


MI SOOK LEE wrote:

Hello,
I have PhpMyAdmin  2.6.3 , MySQL 4.1.13 running in my Windows 2000.
I installed them using Apache friends XAMPP, so I didn¡¯t do any 
configuration myself.
Currently if I go to http://127.0.0.1/phpmyadmin, then it automatically 
shows my local MySQL db and tables.
Now I need to connect remote server(it has MySQL) and do some DB Admin 
of that server.

How can I connect to that server from phpmyadmin?
I¡¯ve been trying to find if there any kind of connect panel in 
phpmyadmin, but no fruit yet.


I really appreciate you guys help.


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



[PHP] Re: Hidden Form Help

2005-10-12 Thread Ethilien

To answer your questions:

1) No, there is no way to make data show up in both fields because the 
script you are currently using is probably echoing the data directly 
into a value attribute of the elements themselves. Also, by making two 
different elements in the same form have the same name, and two 
different page elements have the same id, you are introducing a level of 
instability into the DOM that could result in no data being submitted at 
all if some browsers do not handle multiple occurrences of the same id 
in a page the same way (such as submitting the value from the first 
occurrence of the name rather than the last, resulting in the input in 
the hidden form being used).


2) Javascript would be your only hope of doing this, but as I said 
regarding the DOM, their is no way to independently access two page 
elements with the same id, so even Javascript cannot do this.


I would recommend that, even though the application does not allow 
templating, you can still change its source code for displaying the form 
to allow you to template it that way.


Hope this helps,
-Connor Mckay

Alnisa Allgood wrote:

Hi-

I'm in a situation where I'm required to deal with a hidden form. The
background details are exhausting, but the gist is: one form is
auto-generated and lacks proper formatting. It was part of an open
source package that DID NOT allow templating. So to keep using the
application engine, but provide formatting, I created a CSS class to
hide the unformatted form while displaying the formatted form.

When submitting data to the database this doesn't seem to cause any
issues. It accepts data based on the fieldvalues and ids. But when
retrieving data to repopulate the form, what happens is that the
hidden form gets the values and the displayed form does not.

http://nahic.ucsf.edu/phpESP/survey.php
login= Wisconsin

Basically, if you complete the required field (state), fill out some
random data, hit save, then select resume from the info page
provided. You'll get back an empty form. But if you look at the code
you'll see that the hidden form has the values.

So I have a few questions:

1) Is there anyway to echo data from one field to the next, especially
if the field (name or id) are exactly the same??  (i.e. field=state
value=Wisconsin; if the field state is then repeated somewhere else on
the page, can the value, Wisconsin, also be automatically repeated.

2) If yes, to the above can PHP do this and how? or is this something
requiring Javascript or some other coding.


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



[PHP] Re: Small regex help?

2005-10-12 Thread Ethilien

Hmmm,
/SELECT .* FROM (.*) WHERE (.*) ORDER BY .*/Ui, SELECT count(*) FROM 
\$1 WHERE \$2


Might work, but haven't tried it...

Guy Brom wrote:

Can anyone suggest the correct regex to replace col1,col2... with count(*)
and strip out everything just before ORDER BY?

so for this:
SELECT col1,col2... FROM tbl WHERE filter1 filter2 ORDER BY order1,order2

I would get this:
SELECT count(*) FROM tbl WHERE filter1 filter2

Thanks!


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



Re: [PHP] Re: preg_match_all question

2005-07-31 Thread Ethilien
Actually, I meant what is an actual example of a link it will match. 
like a href=something.htmtext/a for example.


Chris Bruce wrote:

It matches any link with the exception of https links.

On Jul 20, 2005, at 3:36 PM, Ethilien wrote:

I don't see anything in this regex that would prevent https from being 
matched, since you don't specify the pattern of the actual url at all.


What is an example of a link that it will match?

Chris Bruce wrote:


Hello,
I am using the following to do link replacing:
preg_match_all(/\s*a\s+[^]*href\s*=\s*[\']?([^\' ]+)[\'  
]/isU,$file[$x],$matches);
It works great for all but 'https' links. I am not that versed in 
regular expressions. Would anyone know what I need to put in there so 
that it will match on https links?

Thanks,
Chris


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



[PHP] Re: mysql problem- I know it isn't strictly php

2005-07-20 Thread Ethilien
That last line always causes me problems, I think it is probably a 
difference in versions of mysql. Just change the last line to:


);

without any of the text in their. It doesn't really do much anyway.

Ross wrote:

Hi all,

I am trying to create a table on the remote server but it never seems to 
work


CREATE TABLE `sheet1` (
  `id` int(10) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL default '',
  `fname` varchar(255) NOT NULL default '',
  `sname` varchar(255) default NULL,
  `job_title` varchar(255) default NULL,
  `organisation` varchar(255) default NULL,
  `email` varchar(255) default NULL,
  `street` varchar(255) default NULL,
  `city` varchar(255) default NULL,
  `postcode` varchar(255) default NULL,
  `office_tel` varchar(255) default NULL,
  `mobile` varchar(255) default NULL,
  `fax` varchar(255) default NULL,
  `web` varchar(255) default NULL,
  `add_info` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=303 ;


There seems to be a problem with the last line (this is exported from my 
local server). I am just learning about mySql as I go so have no real clue 
about CHARSET and ENGINE (which I believe may be the problem)


This is the error

1064 - You have an error in your SQL syntax.  Check the manual that 
corresponds to your MySQL server version for the right syntax to use near 
'DEFAULT CHARSET=latin1 AUTO_INCREMENT=303' at line 18


and this is what the manual  says (not very helpful)

a.. Error: 1064 SQLSTATE: 42000 (ER_PARSE_ERROR)

Message: %s near '%s' at line %d


Any help will be appreciated.

R. 


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



[PHP] Re: preg_match_all question

2005-07-20 Thread Ethilien
I don't see anything in this regex that would prevent https from being 
matched, since you don't specify the pattern of the actual url at all.


What is an example of a link that it will match?

Chris Bruce wrote:

Hello,

I am using the following to do link replacing:

preg_match_all(/\s*a\s+[^]*href\s*=\s*[\']?([^\' ]+)[\' 
 ]/isU,$file[$x],$matches);


It works great for all but 'https' links. I am not that versed in 
regular expressions. Would anyone know what I need to put in there so 
that it will match on https links?


Thanks,

Chris



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



[PHP] Re: Tracking a mobile phone

2005-07-18 Thread Ethilien
I think that would require tapping the cellphone network, which I doubt 
they would let you do since it be a major violation of privacy, because 
you could track the general location of anyone on their network.


Thomas wrote:

Hi there,

 


I was wondering if anybody has attempted to track a mobile phone through a
country. I know that this is usually more a case for the FBI . a friend of
mine is going on a 4 month bike tour and I would like to 'track' him for
locations. I thought of an sms receiving system, but if could do any other
way would be great.

 


Any ideas?

 


Thomas




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



[PHP] Include path quirks

2005-07-18 Thread Ethilien
I've been attempting to write an application with a bit more ordered 
directory structure than I normally use, and I ran into the rather 
annoying problem with include() where relative paths are only based off 
of the current working directory, and not that of the included script. 
This makes it impossible to include script correctly, because the path 
from the working directory is different than that of the included file.


The problem is I'm trying to include
/include/global.php

from
/elements/nav.php

but topnav is included by
/index.php

Which results in a failed top open stream error. Is there any way around 
this annoying idiosyncrasy?


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



[PHP] Re: Include path quirks

2005-07-18 Thread Ethilien
Actually, I think I might have found a solution, although its not a very 
good one.


include realpath(dirname(__FILE__) . / . ../include/global.php);

Ethilien wrote:
I've been attempting to write an application with a bit more ordered 
directory structure than I normally use, and I ran into the rather 
annoying problem with include() where relative paths are only based off 
of the current working directory, and not that of the included script. 
This makes it impossible to include script correctly, because the path 
from the working directory is different than that of the included file.


The problem is I'm trying to include
/include/global.php

from
/elements/nav.php

but topnav is included by
/index.php

Which results in a failed top open stream error. Is there any way around 
this annoying idiosyncrasy?


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