Gulsaes
Members-
Posts
16 -
Joined
-
Last visited
Never
Everything posted by Gulsaes
-
nevermind, Solved this buy changing the following lines foreach ($txt as $text) { $x = 0; imagestring($im, $font, $x, $y, $text, $textcolor); $y += ($h + $space); }
-
contents of Textfile to Image, Strange characters showing
Gulsaes replied to Gulsaes's topic in PHP Coding Help
Found a Solution using any of the following would remove the strange characters which turned out to be line feeds CR/LF etc str_replace( array("\r\n","\r","\n") , '<br>' , $subject); Alternatively: str_replace( array("\0x0d\0x0a","\0x0d","\0x0a") , '<br>' , $subject); Alternatively: str_replace( array(chr(13).chr(10) , chr(13) , chr(10)) , '<br>' , $subject); -
I'm using the following code to generate images from text, i have got the wrap working but everything is centered, i would like the text aligned left as i'm new to image creation commands i'm stuck. here is what i have function make_wrapped_txt($txt,$filename,$imc_returner,$space = 4, $font = 2, $w = 600) { $int = hexdec($textcolor); $h = imagefontheight($font); $fw = imagefontwidth($font); $txt = explode("\n", wordwrap($txt, ($w / $fw), "\n")); $lines = count($txt); $im = imagecreate($w, (($h * $lines) + ($lines * $space))); $bg = imagecolorallocate($im, 255, 255, 255); if ($imc_returner == "VMC") {$textcolor = imagecolorallocate($im, 0, 0, 0); } elseif ($imc_returner =="MARGINAL") {$textcolor = imagecolorallocate($im, 255, 0, 255); } elseif ($imc_returner =="IMC") {$textcolor = imagecolorallocate($im, 255, 0, 0); } //$textcolor = imagecolorallocate($im, 0xFF & ($int >> 0x10), 0xFF & ($int >> 0x8), // 0xFF & $int); $y = 0; foreach ($txt as $text) { $x = (($w - ($fw * strlen($text))) / 2); imagestring($im, $font, $x, $y, $text, $textcolor); $y += ($h + $space); } $file = "metar_images/" . $filename . ".png"; imagepng($im,$file); echo "<img src= '$file' />"; }
-
contents of Textfile to Image, Strange characters showing
Gulsaes replied to Gulsaes's topic in PHP Coding Help
function CreateImg($field,$filename,$imc_returner) { $im = imagecreate(600, 30); $bg = imagecolorallocate($im, 255, 255, 255); if ($imc_returner == "VMC") {$textcolor = imagecolorallocate($im, 0, 0, 0); } elseif ($imc_returner =="MARGINAL") {$textcolor = imagecolorallocate($im, 255, 0, 255); } elseif ($imc_returner =="IMC") {$textcolor = imagecolorallocate($im, 255, 0, 0); } // imagefilledrectangle($im, 0, 0, 399, 29, $bg); imagestring($im, 2, 0, 0, $field, $textcolor); $file = "metar_images/" . $filename . ".png"; imagepng($im,$file); echo "<img src= '$file' />"; } the $field is information i have pulled from a text file so the information is in FLLS.txt if i remove the space inbetween 23/17 and Q1023 in the text file its fine but i want to use the str_replace function to remove that character from the text field $field before the image is displayed, but when i open the txt file I dont see the character only a space, So i have no idea what to put in str_replace -
When converting the contents of a text file to an Image inside the text I am seeing strange characters like the character code: 0xDA How would i remove this as i do not see it in the text file see image below after 23/17. what would i Put into str_replace to remove this from the text once i've pulled it from the file ?
-
awesome that works, I always get confused with for and while Thanks A million!!! (anyone invented a Big Red Button for coding? they would make a killing)
-
I currently have $SADC_ARRAY=array('STATION1','STATION3','STATION2'); when printing it out i get Array ( [0] => FAJS [1] => FAJB [2] => FALA [3] => FAWB) since my list is growing i have moved this array to mysql database But i dont have a clue how to get all the results of the Mysql query stored into $SADC_ARRAY similar to what returns with the above code. $query = "SELECT icao_code FROM stations ORDER BY region DESC"; $result = mysql_query($query); for ($i = 0; $row = mysql_fetch_row($result); $i++) { $result_array[$i] = $row; } return $result_array; But I dont seem to get the same result when i print the array it returns Array ( [0] => Array ( [0] => STATION1 ) [1] => Array ( [0] => STATION2 ) [2] => Array ( [0] => STATION3 ) [3] => Array ( [0] => STATION4) [4] => etc Any help would be greatly appreciated thanks in advance.
-
Awsome thank you so Much !!!!
-
I'm new to this hole expression stuff so I really need some help Data i'm looking at is 1306/1412 (DDHH/DDHH) what i currently have is ^([0-3]{1})([0-9]{1})([0-2]{1})([0-9]{1})([0-3]{1})([0-9]{1})([0-2]{1})([0-9]{1})$ but i have no clue how to insert a check for the / any help would be greatly appreciated
-
[SOLVED] More escaping problems - on UPDATE statement
Gulsaes replied to cclark40's topic in PHP Coding Help
Hey Can we assume that you are doing after your $query variable ? $update = mysql_query($query) or die(mysql_error()); also is there a value in $clubnameclicked. -
Nevermind, I had a Form inside a form
-
i'm a bit confused echo '<div class = "MyfavoritesAddto"> <form id="frmAddFavs" name="frmAddFavs" method="post" action="nothing.php"> <input type="hidden" name="fav" value="add"> <input class="AddtoFavsButton" type="submit" name="button" id="AddFavs" value="Add Favorite" /> </form> </div>'; When the button clicks it puts the information in the URL ie http://site/dir/test.php?country=US&fav=add&button=Add+Favorite and returns to test.php instead of nothing.php any ideas
-
awsome, you put me on the right track, all is working nicely now thanks
-
$var =$_GET['var']; echo $var;
-
well the first option would be to declare $var as a Global, otherwise i'd say easiest would be to put your "for" code into a function then call that function from the other page where you wish to display it....
-
Hi i'm fairly noob to php, but since i'm becoming a php freak i thought this was the best site to get some help. I have an array that has lots of text. I'm wanting to break each section of text i want into several separate arrays. current array looks like this Array ( [0] => @ Date: 2008-10-31 - Time 08:55:00 Z @FAJS 310900Z 35012KT 320V040 CAVOK 27/10 Q1022 NOSIG=@FAJB 310800Z AUTO 35004KT //// // ////// 26/12 Q1021=@FALA 310900Z 36017KT CAVOK 29/12 Q1019 RMK RECEIVED AT 08:54=@FAWB 310500Z 06010KT CAVOK 24/13 Q1019 RMK RECEIVED AT 06:05=@FAWK NIL=@FASK 310800Z 03010KT CAVOK 23/// Q1020=@FAPR 310800Z 07007KT CAVOK 19/05 Q1019=@FAIR 310800Z 36009KT CAVOK 26/13 Q1020=@FASI 310800Z AUTO 33007KT //// // ////// 25/15 Q1021=@FAGC 310800Z 33012KT CAVOK 25/11 Q1021 RMK RECEIVED AT 08:02=@FAGM 310900Z 36014KT CAVOK 26/11 Q1021 NOSIG RMK RECEIVED AT 08:52=@FAVV 310800Z AUTO 35006KT //// // ////// 27/12 Q1018=@ @FAPP 310800Z 04009KT 9999 FEW040 25/15 Q1020=@FALM 310800Z 09010KT 8000 FEW013 24/// Q1019=@FAHS 310800Z AUTO 11009KT //// // ////// 25/19 Q1014=@FAPH 310800Z AUTO 13005KT //// // ////// 25/18 Q1018=@FATZ 310800Z AUTO 18002KT //// // ////// 21/17 Q1020=@FATI 310600Z AUTO 02006KT //// // ////// 31/10 Q1016=@FAER 310800Z AUTO 04007KT //// // ////// 32/12 Q1016=@FATH 310800Z 16003KT 9999 BKN020 24/19 Q1017=@ @FAMM 310800Z 24004KT 9999 FEW040 30/05 Q1017=@FALI 310800Z AUTO 33009KT //// // ////// 30/M00 Q1018=@FAKD 310800Z AUTO 03001KT //// // ////// 29/06 Q1017=@FARG 310900Z AUTO 34005KT //// // ////// 31/10 Q1015=@FAPN 310700Z AUTO 03004KT //// // ////// 30/10 Q1017 RMK RECEIVED AT 07:14=@FAPS 310800Z AUTO 01007KT //// // ////// 29/// Q1017=@@FANS 310800Z AUTO 06006KT //// // ////// 18/18 Q1020=@FAKN 310800Z 08007KT 0100 -DZFG OVC001 18/18 Q1021 NOSIG=@FAEO 310800Z 03013KT 9999 SCT015 22/13 Q1024=@FASR 310800Z AUTO /////KT //// // ////// 25/12 Q1020=@FAWI 310800Z AUTO 02009KT //// // ////// 24/14 Q1024=@@FADN 310830Z 11009KT 080V160 9999 FEW030 23/16 Q1017 NOSIG=@FAVG 310800Z AUTO 10004KT //// // ////// 22/14 Q1017=@FAMG 310800Z AUTO 11005KT //// // ////// 23/16 Q1018=@FAPM 310800Z 09010KT CAVOK 20/10 Q1018 RMK RECEIVED AT 08:20=@FAGY 310800Z AUTO 03006KT //// // ////// 19/15 Q1019=@FALY 310800Z AUTO 09002KT //// // ////// 21/12 Q1019=@FANC 310800Z AUTO 07003KT //// // ////// 22/17 Q1019=@FAVY NIL=@FARB 310800Z 21006KT 8000 SCT020 BKN050 25/20 Q1017 RMK RECEIVED AT 08:05=@FAUL 310800Z AUTO 07003KT //// // ////// 20/12 Q1019=@FAMX 310800Z AUTO 19002KT //// // ////// 20/17 Q1018=@@FABL 310800Z 35009KT CAVOK 26/03 Q1018 NOSIG=@FABM 310800Z 04007KT CAVOK 21/12 Q1021=@FAWM 310600Z AUTO 06010KT //// // ////// 21/12 Q1019=@FAHV 310600Z AUTO 07005KT //// // ////// 18/09 Q1017=@ @FAKM 310800Z 26001KT CAVOK 27/M03 Q1017=@FAUP 310800Z 15002KT CAVOK 29/M06 Q1015=@FASS 310800Z AUTO 36002KT //// // ////// 29/M07 Q1017=@FASB 310800Z 08002KT CAVOK 26/M06 Q1017=@FAAB 310800Z AUTO 22006KT //// // ////// 15/10 Q1015=@FACV 310800Z 35002KT CAVOK 23/M06 Q1016=@FADY 310800Z 34002KT CAVOK 25/06 Q1017=@ @FACT 310900Z 26005KT 190V320 CAVOK 22/12 Q1014 NOSIG=@FAGG 310900Z 13010KT 9999 FEW025 19/12 Q1015=@FALW 310600Z AUTO 24003KT //// // ////// 14/12 Q1014=@FAOB NIL=@FABY 310900Z AUTO 12003KT //// // ////// 22/08 Q1014=@FAPG 310800Z AUTO 09005KT //// // ////// 19/// Q1016=@ @FAPE 310830Z 12006KT 070V190 CAVOK 21/13 Q1016 NOSIG=@FAEL 310900Z 11009KT 080V140 9999 SCT023 BKN048 21/14 Q1016=@FAUT 310800Z 11007KT CAVOK 21/11 Q1018=@@FDMS 310800Z 00000KT 4000 -DZFG SCT008 OVC025 17/17 Q1020 @ NOSIG=@@FXMM 310900Z 36008KT CAVOK 27/04 Q1021 NOSIG=@@FBSK 310800Z 36003KT CAVOK 31/10 Q1016 NOSIG=@FBMN 310800Z 06013KT CAVOK 35/09 Q1015=@FBFT 310800Z 07007KT CAVOK 35/13 Q1016=@FBGZ NIL=@FBJW NIL=@FBKE 310800Z 18006KT CAVOK 29/12 Q1017=@FBMP NIL=@FBPA NIL=@FBTE NIL=@FBTS NIL=@FBSN NIL=@FBSP 310800Z 09014KT CAVOK 34/13 Q1016=@FBSW NIL=@FBLT NIL=@@FYWH 310900Z AUTO 05004KT //// // ////// 30/M00 Q1023=@FYWW 310800Z 26003KT CAVOK 28/02 Q1022=@FYKT 310800Z 00000KT CAVOK 26/03 Q1017=@FYWB 310800Z /////KT //// ////// ///// Q////=@FYGF 310800Z 19004KT CAVOK 30/02 Q1012=@FYLZ 310800Z AUTO 18009KT //// // ////// 19/10 Q1013=@FYOA 310800Z /////KT //// ////// ///// Q////=@@FQMA 310900Z 14004KT 110V220 9999 SCT018 BKN025 27/20 Q1016 NOSIG=@FQBR 310800Z 13009KT 100V160 9999 SCT017 30/21 Q1014=@FQNP 310800Z 03007KT 9999 BKN020 31/18 Q1016=@FQIN 310800Z 36003KT 9999 BKN020 27/22 Q1015=@FQLC 310800Z 05011 9999 BKN012 24/18 Q1021=@FQPB 310800Z 07009KT FEW020 FEW025CB 29/22 Q1015 RMK CB TO S/W=@FQQL 310800Z 00000KT CAVOK 32/17 Q1014=@FQTE NIL=@FQTT 310800Z 14008KT 9999 FEW020 33/23 Q1012=@FQVL NIL=@@FVHA 310800Z NIL=@FVBU 310800Z NIL=@FVTL 310800Z NIL=@FVCZ 310800Z NIL=@FVKB 310800Z NIL=@FVFA 310800Z NIL=@FVWN 310800Z NIL=@ @FWKI 310700Z 09012KT 9999 FEW022 25/17 Q1020 NOSIG=@FWCL 310700Z NIL=@FLLS 310800Z 06007KT CAVOK 29/10 Q1019NOSIG=@FLND 310400Z 07002KT 8000 FU SKC 17/11 Q1018=@FNLU NIL=@ @ ) want i'm wanting is to get the text between the @ and store them into seperate arrays and use the first 4 characters of each line between the @ ie. FAJS as the array name any help would be greatly appreciated.