Re: [PHP] Making thumbs same size

2007-06-04 Thread Christian Haensel

Morning :o)

This is what I am using

--- SNIP 
?php
// The file
$filename   =   $_GET['filename'];
$file   =   $_GET['filename'];
$target_path=   ../_images/news/;
$filename = $target_path.$filename;

// Set a maximum height and width
$width = 250;
$height = 250;

// Content type
header('Content-type: image/jpeg');

// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);

$ratio_orig = $width_orig/$height_orig;

if ($width/$height  $ratio_orig) {
  $width = $height*$ratio_orig;
} else {
  $height = $width/$ratio_orig;
}

// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
$dest_path = ../_images/news/;
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height,
$width_orig, $height_orig);
$dest_file  =   $dest_path.thumb_.$file;

// Output
imagejpeg($image_p, $dest_file, 100);

?


- SNAP ---

If I read it now, I must admit that it might be hard to understand (even I
am having a hard time reading it... I guess there is some useless stuff in
there, too)... but I haven't had coffee yet, so I might be able to explain
that stuff to you a bot late. But maybe this code example does help you...
if not, please ask. :o) I will try my best then ... hopefully you just
needed the calculation part :oP

Cheerio mate

Chris



- Original Message - 
From: Humani Power [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Monday, June 04, 2007 8:44 AM
Subject: [PHP] Making thumbs same size



Hey hi!!.

I have a few pages that uploads images to the apache server and makes a
registry on a mysql database. Everything is going well just for a few
details.

When I make the upload for an image, it creates me a thumb image, but not
as
I want. For example, if I have an image that its of 2000 x 2000 px, the
thumb created is 200 x 200, If I upload another with 300x300 px, my thumb
will be 30x30 px, making look the gallery pretty bad.  The only thing that
I
need is that all my thumbs were on the same size.
I've tried to modify the thumb width and height size, but doesnt work..
Probably I am not undersatnding hoy to use the resampling() tool.

here is my code.

?php
include(connection.php);
//make variables avaliable
$image_caption = $_POST['image_caption'];
$image_username = $_POST['image_username'];
$image_tempname = $_FILES['image_filename']['name'];
$image_date = date($_POST['image_date']);
$today= date(Y-m-d);
//upload image and check for image type
$ImageDir=/var/www/apache2-default/images/;
$Imagethumb=$ImageDir.thumbs/;
$ImageName=$ImageDir . $image_tempname;
if (move_uploaded_file($_FILES['image_filename']['tmp_name'],
$ImageName)) {
//get info about the image being uploaded


list($width, $height, $type, $attr)= getimagesize($ImageName);

//insert info into the table
$insert= insert into rsiis_images
   (image_caption,image_username,image_date,image_date_upload)
   values
   ('$image_caption','$image_username','$image_date','$today');
   $insertresults=mysql_query($insert)
   or die(mysql_error());
   $lastpicid=mysql_insert_id();


   $newfilename=$ImageDir . $lastpicid ..jpg;
   if($type==2){
   rename($ImageName, $newfilename);
   } else {
if ($type==1){
   $image_old=imagecreatefromgif($ImageName);
   }elseif ($type==3){
   $image_old=imagecreatefrompng($ImageName);
   }

   //convert the image to JPG

   $image_jpg=imagecreatetruecolor($width,$height);
   imagecopyresampled($image_jpg,$image_old, 0, 0, 0, 0, $width,
$height,$width,$height);

   imagejpeg($image_jpg,$newfilename);
   imagedestroy($image_old);
  imagedestroy($image_jpg);
   }

$newthumbname=$Imagethumb.$lastpicid..jpg;
//get dimensions of the thumbnail

$thumb_width=$width*0.10;
$thumb_height=$height*.10;

//Create thumbnail
$largeimage=imagecreatefromjpeg($newfilename);

$thumb=imagecreatetruecolor($thumb_width,$thumb_height);
imagecopy($thumb, $largeimage, 0, 0, 0, 0,$width,$height);
   imagecopyresampled($thumb, $largeimage, 0, 0, 0, 0,

$thumb_width,$thumb_height,$width,$height);
imagejpeg($thumb,$newthumbname);
imagedestroy($largeimage);
imagedestroy($thumb);


$url=location:showimage.php?id=.$lastpicid;
header($url);


}


?



thanks for your help



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



Re: [PHP] Database error: Invalid SQL:

2007-05-24 Thread Christian Haensel
Usually you need to specify the type: inner join, left join, right join, 
straight join etc.




OTThat sounds like the good old times when we did air-to-air refueling :oP 
/OT


Sorry, had to :P


- Original Message - 
From: Chris [EMAIL PROTECTED]

To: wisuttorn [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, May 24, 2007 7:34 AM
Subject: Re: [PHP] Database error: Invalid SQL:



wisuttorn wrote:

I have a problem  please help me
when i loged in to egroup this show 
Database error: Invalid SQL: SELECT DISTINCT
egw_cal_repeats.*,egw_cal.*,cal_start,cal_end,cal_recur_date FROM egw_cal
JOIN egw_cal_dates ON egw_cal.cal_id=egw_cal_dates.cal_id JOIN 
egw_cal_user

ON egw_cal.cal_id=egw_cal_user.cal_id LEFT JOIN egw_cal_repeats ON
egw_cal.cal_id=egw_cal_repeats.cal_id WHERE (cal_user_type='u' AND
cal_user_id IN (6,-1)) AND cal_status != 'R' AND 1179939600  cal_end AND
cal_start  1180025999 AND (recur_type IS NULL AND cal_recur_date=0 OR
cal_recur_date=cal_start) ORDER BY cal_start
mysql Error: 1064 (You have an error in your SQL syntax near 'ON
egw_cal.cal_id=egw_cal_dates.cal_id JOIN egw_cal_user ON
egw_cal.cal_id=egw_c' at line 1)


I guess that whatever database you are using doesn't allow 'JOIN' as a 
join type.


Usually you need to specify the type: inner join, left join, right join, 
straight join etc.


Ask your specific database list about it.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Project Management

2007-05-24 Thread Christian Haensel

Morning guys,

this is not exactly a PHP question, but as I am sure that I am talking to 
more or less professional developers, I thought I might ask you.


As I am working on some... well, for my standards... huge project, I thought 
that some kind of project management software would / could be helpful to 
keep track of my ideas, tasks and so on. Right now I am using a huge chunk 
of papers to keep track (as good as I can).


Has any of you any experience with good project management software? Best 
would be OpenSource, of course :o) My boss doesn't want to spend a lot of 
money ;o)


Cheers guys,

Chris from sunny germany 


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



Re: [PHP] Project Management

2007-05-24 Thread Christian Haensel

Hi Edward,

thanks for your comment. I use a lab book too... And already fille two of 
them in the last 8 weeks  I just wanna use the project management thing 
to collect my ideas, and write a howto for future generation developers 
who may have to deal with this thing once I am gone.


Stut,

yes sir, I've used google and had a look at those things. What I wanted was 
to know what you guys use. There is nothing more valuable than the opinions 
of other developers and to know what they use in their day to day job.


Anyhow, my arse is still on... so I better bugger off :oP

Cheers for your comments!

Chris



- Original Message - 
From: Edward Kay [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, May 24, 2007 12:00 PM
Subject: RE: [PHP] Project Management






-Original Message-
From: Christian Haensel [mailto:[EMAIL PROTECTED]
Sent: 24 May 2007 10:27
To: php-general@lists.php.net
Subject: [PHP] Project Management


Morning guys,

this is not exactly a PHP question, but as I am sure that I am talking to
more or less professional developers, I thought I might ask you.

As I am working on some... well, for my standards... huge
project, I thought
that some kind of project management software would / could be helpful to
keep track of my ideas, tasks and so on. Right now I am using a
huge chunk
of papers to keep track (as good as I can).

Has any of you any experience with good project management software? Best
would be OpenSource, of course :o) My boss doesn't want to spend a lot of
money ;o)

Cheers guys,

Chris from sunny germany



If you're working on your own, I would think realistically about how much
you would use such software. I've used Basecamp, Trac, MS Project and 
others
in the past and find them a waste of time. My favourite tool is simply an 
A4

lab book. (I know this doesn't scale, but it fits the bill perfectly for
now).

For initial brainstorming/idea tracking, I do use FreeMind though.
http://freemind.sf.net

HTH, Edward

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



[PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Good morning friends,

I have a script that collects data from a form and puts together a mysql 
query to search a database.
Now, everything worked fine until I added a few new form fields... now the 
$_POST['var'] don't reach the script...


I have about 20 to 25 form fields which are all taken into the query...

Now my question: is there a limit in the fields that I can use in the query 
string to query the database? Somehow the script doesn't even output the 
value of the POST data anymore... been using this stuff for years now, and 
i'm feeling really silly at the moment.


I'd appreciate any help.

Cheers!
Chris 


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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel
Right, here we go... this page has about 1000 lines of code, so here the 
relevant stuff.


$s_query = SELECT * FROM database WHERE
kategorie LIKE '$s_cat' AND
marke LIKE '$s_marke' AND
leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
preis = '$s_preis_von' AND
preis = '$s_preis_bis'.$checkboxes.$sort_str;

I get the $checkboxes from the POST checkboxes, which looks like this (an 
example):


$kraftstoffart = $_POST['fueltype'];
if($kraftstoffart == 3) {
$checkboxes .= ;
}elseif($kraftstoffart == 2) {
$checkboxes .=  AND kraftstoffart = '2';
}elseif($kraftstoffart == 1) {
$checkboxes .=  AND kraftstoffart = '1';
}

and the $sort_str comes in like

$sort_by = $_POST['sort_by'];
$desc_asc = $_POST['desc_asc'];
$sort_str =  ORDER BY .$sort_by. .$desc_asc;


The query then just goes like
$do_q   = mysql_query($s_query) or die(mysql_error());

and that's it...  no errors shown, just the regular output which I had 
before I put the new fields in there. So no changes to what I've had 
before... but there should be changes *g*


I hope anybody can find some sense in what I'm writing here... hardly makes 
sense to me :oP


Cheers!







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

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:36 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:

Good morning friends,

I have a script that collects data from a form and puts together a mysql
query to search a database.
Now, everything worked fine until I added a few new form fields... now 
the

$_POST['var'] don't reach the script...

I have about 20 to 25 form fields which are all taken into the query...

Now my question: is there a limit in the fields that I can use in the 
query

string to query the database? Somehow the script doesn't even output the
value of the POST data anymore... been using this stuff for years now, 
and

i'm feeling really silly at the moment.


AFAIK there is no limit in the number of fields in a query...
post some code please, otherwise I don't think anyone will be able to
help you

greets
Zoltán Németh



I'd appreciate any help.

Cheers!
Chris





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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

I thought so, too. But the part where it receives the data is this:

$s_marke  = $_POST['marke'];
$s_modell  = $_POST['modell'];
$s_preis_von = $_POST['preis_von'];
$s_preis_bis = $_POST['preis_bis'];
$s_mileage_von = $_POST['mileage_from'];
$s_mileage_bis = $_POST['mileage_to'];
$s_ez_von  = $_POST['ez_from'];
$s_ez_bis  = $_POST['ez_bis'];
$s_search_text = $_POST['search_text'];
$s_cat   = $_POST['cat'];
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

(part of it)

And this is the relevant part of the form

select name=kw_von
 option selected=selected value=0***/option
 option value=/60/option

 option value=/75/option
 option value=/90/option
 option value=8181/110/option
 option value=9292/125/option
 option value=110110/150/option
 option value=147147/200/option
 option value=184184/250/option
 option value=220220/300/option
 option value=257257/350/option
/select

The funny thing is that all vars are being received except for the last two:
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

I am s stuck here, it ain't even funny anymore *g* And my boss is, of 
course, waiting for a result. Howcome people don't get that programming 
sometimes really IS leaning back and closing your eyes *gr* :oP


Thanks for trying to help me :o)

Chris

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

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:58 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:

Right, here we go... this page has about 1000 lines of code, so here the
relevant stuff.

$s_query = SELECT * FROM database WHERE
 kategorie LIKE '$s_cat' AND
 marke LIKE '$s_marke' AND
 leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
 preis = '$s_preis_von' AND
 preis = '$s_preis_bis'.$checkboxes.$sort_str;

I get the $checkboxes from the POST checkboxes, which looks like this (an
example):

$kraftstoffart = $_POST['fueltype'];
if($kraftstoffart == 3) {
 $checkboxes .= ;
}elseif($kraftstoffart == 2) {
 $checkboxes .=  AND kraftstoffart = '2';
}elseif($kraftstoffart == 1) {
 $checkboxes .=  AND kraftstoffart = '1';
}

and the $sort_str comes in like

$sort_by = $_POST['sort_by'];
$desc_asc = $_POST['desc_asc'];
$sort_str =  ORDER BY .$sort_by. .$desc_asc;


The query then just goes like
$do_q   = mysql_query($s_query) or die(mysql_error());

and that's it...  no errors shown, just the regular output which I had
before I put the new fields in there. So no changes to what I've had
before... but there should be changes *g*


actually there seems to be no problem with your query (besides that you
should check posted values first in order to avoid SQL injection)

you said in your first letter that $_POST['var'] don't reach the
script - I would guess the relevant part is not the query but rather
the form itself...

greets
Zoltán Németh



I hope anybody can find some sense in what I'm writing here... hardly 
makes

sense to me :oP

Cheers!







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

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:36 AM
Subject: Re: [PHP] PHP  MySQL Problem


 2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt írta:
 Good morning friends,

 I have a script that collects data from a form and puts together a 
 mysql

 query to search a database.
 Now, everything worked fine until I added a few new form fields... now
 the
 $_POST['var'] don't reach the script...

 I have about 20 to 25 form fields which are all taken into the 
 query...


 Now my question: is there a limit in the fields that I can use in the
 query
 string to query the database? Somehow the script doesn't even output 
 the

 value of the POST data anymore... been using this stuff for years now,
 and
 i'm feeling really silly at the moment.

 AFAIK there is no limit in the number of fields in a query...
 post some code please, otherwise I don't think anyone will be able to
 help you

 greets
 Zoltán Németh


 I'd appreciate any help.

 Cheers!
 Chris







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



Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Guys

nevermind... stupid moron that I am I put a hidden action in the form whích 
I totally (!!) forgot... All my code is fine so far, and all is working 
perfectly... now that bloddy thing cost me 3 DAYS of work... sometimes I 
wonder if I should rather sell shoes than calling myself a webdeveloper and 
work at that job all day long... geez!


Anyhow, thanks for your help guys... time for Aspirin over here... laterz!

Chris

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

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 10:16 AM
Subject: Re: [PHP] PHP  MySQL Problem



2007. 05. 21, hétfő keltezéssel 10.04-kor Christian Haensel ezt írta:

I thought so, too. But the part where it receives the data is this:

$s_marke  = $_POST['marke'];
$s_modell  = $_POST['modell'];
$s_preis_von = $_POST['preis_von'];
$s_preis_bis = $_POST['preis_bis'];
$s_mileage_von = $_POST['mileage_from'];
$s_mileage_bis = $_POST['mileage_to'];
$s_ez_von  = $_POST['ez_from'];
$s_ez_bis  = $_POST['ez_bis'];
$s_search_text = $_POST['search_text'];
$s_cat   = $_POST['cat'];
$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];

(part of it)

And this is the relevant part of the form

select name=kw_von
  option selected=selected value=0***/option
  option value=/60/option

  option value=/75/option
  option value=/90/option
  option value=8181/110/option
  option value=9292/125/option
  option value=110110/150/option
  option value=147147/200/option
  option value=184184/250/option
  option value=220220/300/option
  option value=257257/350/option
 /select

The funny thing is that all vars are being received except for the last 
two:

$kw_von   = $_POST['kw_von'];
$kw_bis   = $_POST['kw_bis'];


and if you do a var_dump($_POST) what do you get?
are these values not showing up at all?
if so, then you should check whether they are within the form and
/form tags... I made that mistake once...

greets
Zoltán Németh



I am s stuck here, it ain't even funny anymore *g* And my boss is, of
course, waiting for a result. Howcome people don't get that programming
sometimes really IS leaning back and closing your eyes *gr* :oP

Thanks for trying to help me :o)

Chris

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

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Monday, May 21, 2007 9:58 AM
Subject: Re: [PHP] PHP  MySQL Problem


 2007. 05. 21, hétfő keltezéssel 09.43-kor Christian Haensel ezt írta:
 Right, here we go... this page has about 1000 lines of code, so here 
 the

 relevant stuff.

 $s_query = SELECT * FROM database WHERE
  kategorie LIKE '$s_cat' AND
  marke LIKE '$s_marke' AND
  leistung_kw = '$kw_von' AND leistung_kw = '$kw_bis' AND
  preis = '$s_preis_von' AND
  preis = '$s_preis_bis'.$checkboxes.$sort_str;

 I get the $checkboxes from the POST checkboxes, which looks like this 
 (an

 example):

 $kraftstoffart = $_POST['fueltype'];
 if($kraftstoffart == 3) {
  $checkboxes .= ;
 }elseif($kraftstoffart == 2) {
  $checkboxes .=  AND kraftstoffart = '2';
 }elseif($kraftstoffart == 1) {
  $checkboxes .=  AND kraftstoffart = '1';
 }

 and the $sort_str comes in like

 $sort_by = $_POST['sort_by'];
 $desc_asc = $_POST['desc_asc'];
 $sort_str =  ORDER BY .$sort_by. .$desc_asc;


 The query then just goes like
 $do_q   = mysql_query($s_query) or die(mysql_error());

 and that's it...  no errors shown, just the regular output which I had
 before I put the new fields in there. So no changes to what I've had
 before... but there should be changes *g*

 actually there seems to be no problem with your query (besides that you
 should check posted values first in order to avoid SQL injection)

 you said in your first letter that $_POST['var'] don't reach the
 script - I would guess the relevant part is not the query but rather
 the form itself...

 greets
 Zoltán Németh


 I hope anybody can find some sense in what I'm writing here... hardly
 makes
 sense to me :oP

 Cheers!







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

 To: Christian Haensel [EMAIL PROTECTED]
 Cc: php-general@lists.php.net
 Sent: Monday, May 21, 2007 9:36 AM
 Subject: Re: [PHP] PHP  MySQL Problem


  2007. 05. 21, hétfő keltezéssel 09.26-kor Christian Haensel ezt 
  írta:

  Good morning friends,
 
  I have a script that collects data from a form and puts together a
  mysql
  query to search a database.
  Now, everything worked fine until I added a few new form fields... 
  now

  the
  $_POST['var'] don't reach the script...
 
  I have about 20 to 25 form fields which are all taken into the
  query...
 
  Now my question: is there a limit in the fields that I can use in 
  the

  query
  string to query the database? Somehow the script doesn't even 
  output

  the
  value of the POST data anymore... been using this stuff for years 
  now,

  and
  i'm feeling really silly at the moment.
 
  AFAIK

Re: [PHP] PHP MySQL Problem

2007-05-21 Thread Christian Haensel

Hi there, good morning,

as posted yesterday (I guess it kind of got overlooked by the nmber of posts 
here), I was such a dirk that I put a hidden action in my form that 
redirected the test page to another (currently running) form which didn't 
have the changes in it. So my test page showed me data of a live page... 
dumb me, I know. But after hours and hours of coding, I bet this even 
happens to the best out there :oP Little piece of code sticking somewhere 
and you don't even remember that it is there... that reminds me to continue 
writing the handbook to this website *g*


Have a great coding-day :o))

Chris

- Original Message - 
From: Richard Lynch [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, May 22, 2007 2:42 AM
Subject: Re: [PHP] PHP  MySQL Problem



On Mon, May 21, 2007 2:26 am, Christian Haensel wrote:

Good morning friends,

I have a script that collects data from a form and puts together a
mysql
query to search a database.
Now, everything worked fine until I added a few new form fields... now
the
$_POST['var'] don't reach the script...

I have about 20 to 25 form fields which are all taken into the
query...

Now my question: is there a limit in the fields that I can use in the
query
string to query the database? Somehow the script doesn't even output
the
value of the POST data anymore... been using this stuff for years now,
and
i'm feeling really silly at the moment.

I'd appreciate any help.


POST data *does* have a limit, possibly, based on your selection of
browser/server software...

It's a ridiculously high limit however, so it seems more likely that
you just added a typo to your code.

Show us code to get an answer.

And estimate for us the size of the POST data as well.

Without those bits of info, our answers will be:

Maybe.

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

--
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] Re: showing source

2007-05-18 Thread Christian Haensel

Why don't you use:
highlight_file(__FILE__) ?


OMG

I have been coding that thing for MONTHS now... just to get syntax 
highlighting for my tutorial blog... maybe I shouldn't write tutorials... 
maybe I should rather read them *g*


Thanks for this short, but awesome answer :o) I wasn't the one asking the 
question, but nonetheless you have just wrecked my weekend :oP If I could 
kick my own rear end, I would do so´for the next two days...


Cheers mate, and have a great weekend!

Chris








- tul

James Lockie wrote:

This almost works but all my  and  are replaced with .

   // open this file to show the source
   if (($fh = fopen( __FILE__, 'r' )) === FALSE){
   die ('Failed to open source file (' . $_FILE_ . ') for 
reading!');

   } else {
   $tags  = array( ,  );
   $safe_tags = array( \\, \\ );

   print pre\n;

   // read the file line by line
   while (! feof( $fh )) {
   $currentLine = fgets( $fh, 255 );
   $noTags = str_replace( $tags, $safeTags, $currentLine );
   print $noTags;
   }

   fclose( $fh );
   print /pre\n;
   }


--
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] using preg_match

2007-05-16 Thread Christian Haensel

Hi Ed,

did you try the backslash as escape character?

?
$path = testing/realtors/userdata/;
if(preg_match(/\/realtors/, $path)) {
echo 'Success';
}
?

Works for me :o)

Maybe try http://de3.php.net/manual/en/function.preg-match.php too see some 
examples.


Good luck

Chris

- Original Message - 
From: Ed Curtis [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Wednesday, May 16, 2007 2:12 PM
Subject: [PHP] using preg_match



I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable 
named '$path'.


I know '/' is used as a container within the command itself. How do I 
escape it to find the string '/realtors'?


Thanks,

Ed

--
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] RE: Bounty FYI

2007-05-15 Thread Christian Haensel

You forgot one:

Don't spam!

Regards,

Chris

- Original Message - 
From: Brad Sumrall [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Tuesday, May 15, 2007 8:55 AM
Subject: [PHP] RE: Bounty FYI



Food for thought!

Respect the freedom.

Respect the Internet!

We all benefit!

Never abuse!




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



Re: [PHP] RE: Bounty FYI

2007-05-15 Thread Christian Haensel
ROFL... you really made my day... it's about 9am, been working for 2 hours 
now, and the day is great already!


Worked for the DoD and stuff like that, and still doesn't know how to 
behave. You remind me of a 14 years old guy I knew from Bahrain... always 
trying to mess with the big boys.


Go play outside :o) Mr DoD *ROFL*

- Original Message - 
From: Brad Sumrall [EMAIL PROTECTED]

To: 'Christian Haensel' [EMAIL PROTECTED]
Sent: Tuesday, May 15, 2007 9:06 AM
Subject: RE: [PHP] RE: Bounty FYI



When did I request money?

Go hit your Webster's schmuck!

-Original Message-
From: Christian Haensel [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 15, 2007 3:01 AM
To: Brad Sumrall; php-general@lists.php.net
Subject: Re: [PHP] RE: Bounty FYI

You forgot one:

Don't spam!

Regards,

Chris

- Original Message - 
From: Brad Sumrall [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Tuesday, May 15, 2007 8:55 AM
Subject: [PHP] RE: Bounty FYI



Food for thought!

Respect the freedom.

Respect the Internet!

We all benefit!

Never abuse!







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



[PHP] Image Resize with LibGD

2007-05-08 Thread Christian Haensel

Good morning,

I am using imagecreatetruecolor() and imagecopyresampled() to resize 
oversized images and am overlaying them with an transparent PNG to add a 
watermark. That works just well for oversized images.


Now, let's say I have a small image and would like to stretch it by 50 to 
100% of its original size... I know there will be a loss of quality. But 
maybe someone out there has had to deal with the same before and knows the 
best way to do that?


Any suggestion would be very much appreciated :o)

Greetings from germany,

Chris

--
Chriatian Haensel
Fulltime WebSlave
http://www.chftp.com 


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



Re: [PHP] PHP MySQL - Field Title

2007-04-30 Thread Christian Haensel

Hi Oliver,

below is what I used.

?
mysql_con();
$insert_q = INSERT INTO DB1 VALUES(;
$query = SELECT * FROM vorlauf WHERE satz_nr = '$fzg_id' LIMIT 1;
$doit = mysql_query($query);
$data = mysql_fetch_assoc($doit);
for($i=0; $i=126; $i++) {
 $fieldname = mysql_field_name($doit, $i);
 $value = $data[$fieldname];
 if($value == ) {
  $value=0;
 }
 if($fieldname == lfd_id) {
  $value=;
 }
 echo $fieldname. -- .$value.br;
 $titel = $fieldname;
 $insert_q .= ,'$value';
}
$insert_q = $insert_q.')';
$insert_q = eregi_replace(\(,,(, $insert_q);
echo p;
echo $insert_q;
mysql_query($insert_q) or die(mysql_error());
echo Yup;
$del_q = DELETE FROM vorlauf WHERE satz_nr = '$fzg_id' LIMIT 1;
$do_del = mysql_uery($del_q);
?


I'm sure there are better ways to do the whole thing :o) But as long as I 
need to cpy one record at a time, I don't really care much for speed. I just 
put all the stuff into a string and then use that string as query for the 
insertion into the second database.


Scripts like that make me feel good when I say You can be dumb as heck, ás 
long as you find a way to resolve your problems :o) It works, and it took 
me just about 10 minutes of research and another 10 of writing :o)


Hope your weather is just as good as ours here...

All the best!

Chris

- Original Message - 
From: Oliver Block [EMAIL PROTECTED]

To: php-general@lists.php.net
Cc: Christian Haensel [EMAIL PROTECTED]
Sent: Monday, April 30, 2007 1:11 PM
Subject: Re: [PHP] PHP  MySQL - Field Title



Am Montag, 30. April 2007 07:47 schrieb Christian Haensel:

but now I have the problem with the field names and all... can someone
point me into the right direction?


http://www.php.net/manual/de/ref.mysql.php

php-db at lists.php.net

If you need to use an assoc array, use the following SQL Syntax:

INSERT INTO new_table SET key0=value0, key2=value2, ...,

Regards,

Oliver

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



[PHP] PHP MySQL - Field Title

2007-04-29 Thread Christian Haensel

Good Morning guys and girls

As I am rather lazy, I don't wanna do a data readout on my MySQL table in 
the following way with mysql_fetch_assoc()


$data_item1=$data['xitem1'];
$data_item2=$data['yitem2];


I am trying to do the following:

I have the correct number of fields in the table, which is 116. Now I want 
to use a for-loop and read teh data into a string, then shove it into 
another table, which has the exact same layout. I was thinking about 
something like


for($i=0; $i= 115; $i++) {
   $data_item[$i]=$data[$i];
}

but now I have the problem with the field names and all... can someone point 
me into the right direction? All I have to so is move the contents of one 
field to the second database wich has the same layout as the first DB.


Would be thankful for any help :o)

Cheers!

Chris 


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



[PHP] echo or print ?

2007-04-17 Thread Christian Haensel

Good morning fellow coders

I've been working with PHP for a little over 5 years now, and it even got me 
a cute office and a good salary... but even though I can make a living off 
of it, I am still wondering about a few little things.


Whenever I see people put their code up for review, I realize they mostly 
use print instead of echo, while I am using echo 99% of the time. Actually, 
I can't even remember when I last used the regular print.


What do you guys use, and what is the advantage (if ther is any) of print 
over echo? And I am not talking about print_r or anything, just the regular 
print. :o)


All the best!

Chris


Christian Haensel
/voodoo.css
#GeorgeWBush { position:absolute; bottom:-6ft; } 


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



Re: [PHP] echo or print ?

2007-04-17 Thread Christian Haensel
Thanks mate, that clarifies that. And now I know why I use echo all the time 
*g*


Have a great day,... greetings from sunny germany :o)

Chris

- Original Message - 
From: Dimiter Ivanov [EMAIL PROTECTED]

To: Christian Haensel [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Tuesday, April 17, 2007 9:48 AM
Subject: Re: [PHP] echo or print ?



On 4/17/07, Christian Haensel [EMAIL PROTECTED] wrote:

Good morning fellow coders

I've been working with PHP for a little over 5 years now, and it even got 
me
a cute office and a good salary... but even though I can make a living 
off

of it, I am still wondering about a few little things.

Whenever I see people put their code up for review, I realize they mostly
use print instead of echo, while I am using echo 99% of the time. 
Actually,

I can't even remember when I last used the regular print.

What do you guys use, and what is the advantage (if ther is any) of print
over echo? And I am not talking about print_r or anything, just the 
regular

print. :o)


There is a link in the manual about the difference between those two:

http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40 


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