RE: [PHP-DB] Bad picture colors

2006-04-28 Thread nikos
Martin you really save my ass!!
imagecopyresampled() is what I need.
It is 3 times slower but how cares, I run it in a local server.

Thank you vary much!

  _  

 
Γατσής Νίκος - Gatsis Nikos
Web developer
tel.: 2108256721 - 2108256722
fax: 2108256712
email: [EMAIL PROTECTED]
http://www.qbit.gr 

-Original Message-
From: Martin Alterisio [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 27, 2006 10:50 PM
To: nikos
Cc: PHP-mailist (PHP-mailist)
Subject: Re: [PHP-DB] Bad picture colors

2006/4/27, nikos [EMAIL PROTECTED]:

 Hello list

 I use the following code to shrink some photos.

 $directory='/var/www/html/offroads/tmp/';
 $dir=opendir($directory);
 while($file=readdir($dir)) {
 $dirfile=$directory.$file;
 if(is_file($dirfile)) {
 copy($dirfile,$directory.sm/sm_.$file);
 $imgReal = ImageCreateFromJPEG($dirfile);
 $x = ImagesX($imgReal);
 $y = ImagesY($imgReal);
 $newX=$x*0.1783;
 $newY=$y*0.1783;
 $img = ImageCreate($newX,$newY);
 ImageCopyResized($img, $imgReal, 0, 0, 0, 0,
 $newX,
 $newY, $x, $y);
 //$newimg=imagecolorstotal($img);
 ImageJPEG($img,$directory.sm/sm_.$file);
 clearstatcache();
 }
 }
 closedir($dir);

 My problem is that the color results are very bad. How can I take picture
 with good colors?

 Thank you

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



Try using imagecopyresampled() instead of imagecopyresized(). It uses a more
precise algorithm which means: more time to complete. But since it seems
you're creating a cache of resized images that won't mather once the resize
its done.

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



RE: [PHP-DB] Bad picture colors

2006-04-28 Thread nikos gatsis
Martin you really save my ass!!
imagecopyresampled() is what I need.
It is 3 times slower but how cares, I run it in a local server.

Thank you vary much!

  _  

 
Γατσής Νίκος - Gatsis Nikos
Web developer
tel.: 2108256721 - 2108256722
fax: 2108256712
email: [EMAIL PROTECTED]
http://www.qbit.gr 

-Original Message-
From: Martin Alterisio [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 27, 2006 10:50 PM
To: nikos
Cc: PHP-mailist (PHP-mailist)
Subject: Re: [PHP-DB] Bad picture colors

2006/4/27, nikos [EMAIL PROTECTED]:

 Hello list

 I use the following code to shrink some photos.

 $directory='/var/www/html/offroads/tmp/';
 $dir=opendir($directory);
 while($file=readdir($dir)) {
 $dirfile=$directory.$file;
 if(is_file($dirfile)) {
 copy($dirfile,$directory.sm/sm_.$file);
 $imgReal = ImageCreateFromJPEG($dirfile);
 $x = ImagesX($imgReal);
 $y = ImagesY($imgReal);
 $newX=$x*0.1783;
 $newY=$y*0.1783;
 $img = ImageCreate($newX,$newY);
 ImageCopyResized($img, $imgReal, 0, 0, 0, 0,
 $newX,
 $newY, $x, $y);
 //$newimg=imagecolorstotal($img);
 ImageJPEG($img,$directory.sm/sm_.$file);
 clearstatcache();
 }
 }
 closedir($dir);

 My problem is that the color results are very bad. How can I take picture
 with good colors?

 Thank you

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



Try using imagecopyresampled() instead of imagecopyresized(). It uses a more
precise algorithm which means: more time to complete. But since it seems
you're creating a cache of resized images that won't mather once the resize
its done.

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



[PHP-DB] multi-table insert

2006-04-28 Thread Eustace
Hello everybody!
I am very much a newbie in PHP, but enjoying the learning process. Here and
there I get tangled in the logic of certain problems. Anyway, I have a
database about interns and this database has multi-tables told data of
interns, for example personal information, education qualifications,
computer skills, languages etc. The relationship of the tables is based on
the intern's username. 
What I am trying to do is have a form, which an intern can fill in so that
details are inserted into the database. Since I am populating a number of
tables in one go, what's the best way to implement this? The main table is
the personal information one, which has the username as primary key, and the
rest of the tables username is the foreign key. Obviously I need the to pick
the username from the main table and insert it into the other tables. How
best can I do this?
 
Sorry this is a bit like an essay, but please assist. I know it looks
obvious to the experienced guys, but am having a bit of a problem. Thanks
 
Eustace


[PHP-DB] Example of mail()

2006-04-28 Thread Renzo Clavijo
Hi all.
  
  In the code bellow you'll find an easy to use example of mail(). 
  
  I know it's very simple but the question is: How can I erase the values  held 
in $_REQUEST such that when I press F5 or I click Reload there  are no 
messages sent again?
  
  Thanks a lot for your help.
  
  
  Best Regards
  
  
  RENZO CLAVIJO
  
  PD: Please forgive me if my english is not OK
  
  

-
Get amazing travel prices for air and hotel in one click on Yahoo! FareChase 

[PHP-DB] Example of mail()

2006-04-28 Thread Renzo Clavijo
Hi all.

In the code bellow you'll find an easy to use example of mail(). 

I know it's very simple but the question is: How can I erase the 
  values  held in $_REQUEST such that when I press F5 or I click Reload 
  there  are no messages sent again?

Thanks a lot for your help.


Best Regards


RENZO CLAVIJO

PD: Please forgive me if my english is not OK
  
  
  
  --
  
  
  html
  head
  titleCorreo/title
  /head
  
  body
  
  form name=form_send method=post target=?php echo 
$_REQUEST['PHP_SELF'];?
  
  Address: input type=text name=address_mail size=20
  br
  
  Subject: input type=text name=subject size=20
  br
  
  Message: input type=text name=message size=20
  br
  
  input type=submit name=send_mail value=Enviar
  
  /form
  
  /body
  
  ?php
  if(isset($_REQUEST['send_mail'])){
  mail($_REQUEST['address_mail'],$_REQUEST['subject'],$_REQUEST['message']);
  }
  ?
  
  /html
  
  
  
  
  
  

-
Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! 
Messenger with Voice.

[PHP-DB] Re: Sheduled task for Php-MySql script

2006-04-28 Thread John Ellingsworth

[EMAIL PROTECTED] wrote:

Hi all,
 
I have some php scripts that i have to run automatically at 5.00am (on Windows platform). I am using MySql. 
I've tried using Scheduled Task and Cron, and i converted the extension files to .bat format. But always error on functions mysql_connect,mysql_query,and other DBS functions. I don't know how to Scheduled Task or Cron recognize those functions. 
 
Can anyone help me please?




Have you confirmed the that you can run the script from the command line?

Try reviewing this and see if your issues are relevant; we can go from 
there:

http://us3.php.net/features.commandline

--
Regards,

John Ellingsworth
http://john.ellingsworth.org

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



[PHP-DB] Re: Example of mail()

2006-04-28 Thread benmoreassynt
Renzo Clavijo wrote:


   ?php
   if(isset($_REQUEST['send_mail'])){
   mail($_REQUEST['address_mail'],$_REQUEST['subject']
$_REQUEST['message']);
   }

I would try something like this:


  if(isset($_REQUEST['send_mail']))
{
mail($_REQUEST['address_mail'],$_REQUEST['subject']
$_REQUEST['message']);
unset($_REQUEST);
}

That should wipe all the variables in $_REQUEST before the user clicks
reload. It will not work on a global variable if you use it inside a
function. There are other ways to do the same thing, but I think that
should do it.

BMA

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



[PHP-DB] Re: Example of mail()

2006-04-28 Thread benmoreassynt
benmoreassynt wrote:


 I would try something like this:
 
 
   if(isset($_REQUEST['send_mail']))
 {
 mail($_REQUEST['address_mail'],$_REQUEST['subject']
 $_REQUEST['message']);
 unset($_REQUEST);
 }

As a follow up, if you want to use that in a public environment, you really
need to run the $_REQUEST array through something like strip_tags() at the
very least, and probably write your script in such a way that nobody can
inject headers into the form for spamming. The archives of the PHP mailing
list include ways to do it.

BMA

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



[PHP-DB] capture a webpage to later process it

2006-04-28 Thread J. Alejandro Ceballos Z. -JOAL-


I want to read the results of an URL address, to later process it and 
insert part of them as internal code.


If I use include or require, they inserts ALL the resulting code, but I 
want to do something like:



blah, blah, blah
?php
 $result_webpage = somephpfunc('http://other.sit/externalpage.html');
 if 
(eregi(result:([:alnum:]+).*([:alnum:]+\.jpg),$result_webpage,$array_match))
   { echo h2External status:.$array_match[1].brimage: img 
src=\..$array_match[2].\/h2;  }

?
 blah, blah, blah


TIA,

 ,_, 
(O,O)   J. Alejandro Ceballos Z.  [EMAIL PROTECTED]  
(   )
---
http://alejandro.ceballos.infomovil: (33) 3849-8936  


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



Re: [PHP-DB] capture a webpage to later process it

2006-04-28 Thread John Hicks

J. Alejandro Ceballos Z. -JOAL- wrote:


I want to read the results of an URL address, to later process it and 
insert part of them as internal code.


If I use include or require, they inserts ALL the resulting code, but I 
want to do something like:



blah, blah, blah
?php
 $result_webpage = somephpfunc('http://other.sit/externalpage.html');
 if 
(eregi(result:([:alnum:]+).*([:alnum:]+\.jpg),$result_webpage,$array_match)) 

   { echo h2External status:.$array_match[1].brimage: img 
src=\..$array_match[2].\/h2;  }

?
 blah, blah, blah


If you have fopen wrappers enabled (see 
http://us2.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen) 
then you can simply use file_get_contents() to read the web page into a 
string. You can then manipulate it with regexes like so:


$Url = 'http://www.php.net';
$ThePageContents = file_get_contents($Url);
$TheNewPageContents = preg_replace('/PHP/', 'Ruby :)', $ThePageContents);
echo $TheNewPageContents;

--J

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