php-general Digest 30 Nov 2005 14:19:38 -0000 Issue 3824 Topics (messages 226612 through 226638):
checkboxes 226612 by: blackwater dev 226618 by: Matt Monaco 226624 by: Curt Zirzow url vs dirname(__FILE__) 226613 by: Chris 226616 by: Chris Shiflett help avoid multiple login 226614 by: mail.pmpa 226615 by: mail.pmpa 226627 by: Mark Rees 226628 by: Jochem Maas Re: PhpMailer vs Pear:Mail 226617 by: Manuel Lemos 226620 by: Curt Zirzow How do i display a neat table of returned mysql data? 226619 by: Dave Carrera 226634 by: Ciprian Constantinescu Re: Two version of PHP in single server 226621 by: Curt Zirzow Re: when to enter submitted in mysql? 226622 by: Curt Zirzow Re: migrating from http to https... 226623 by: Curt Zirzow GD2 Question 226625 by: Karuna 226626 by: Jochem Maas 226635 by: Ciprian Constantinescu 226636 by: Jochem Maas MVC platform choice. 226629 by: Gregory Machin 226631 by: Fabiano Ricci imap_mail_move 226630 by: Georgi Ivanov Re: Howto search in SQL for a specific character? 226632 by: Jesús Fernández 226633 by: Ciprian Constantinescu 226637 by: Albert Re: Merging two images (GD & PNG) 226638 by: Albert 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: php-general@lists.php.net ----------------------------------------------------------------------
--- Begin Message ---I have a form where I am dynamically building a bunch of checkbox inputs. Then when submitted, I need to update the db. Problem is, of course, if the checkbox is unchecked then the $_POST doesn't have the value in the array. How can I get the value from $_POST even though it's unchecked? For example, here would be the generated form: <input type="checkbox" name="cars[2]" value="1">Car 1 <input type="checkbox" name="cars[3]" value="1">Car 2 <input type="checkbox" name="cars[4]" value="1">Car 3 <input type="checkbox" name="cars[5]" value="1">Car 4 Then in the update I loop through: foreach($_POST[cars] as $id=>$value){ //update vehicles set value to yes or no } But, if the unchecked values aren't in $_POST, how do I know to update them??? Thanks!
--- End Message ---
--- Begin Message ---Well if your keys are a straight sequence of numbers instead of a foreach you can do a for loop and for those whose value is not one, set to zero. Matt "blackwater dev" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] I have a form where I am dynamically building a bunch of checkbox inputs. Then when submitted, I need to update the db. Problem is, of course, if the checkbox is unchecked then the $_POST doesn't have the value in the array. How can I get the value from $_POST even though it's unchecked? For example, here would be the generated form: <input type="checkbox" name="cars[2]" value="1">Car 1 <input type="checkbox" name="cars[3]" value="1">Car 2 <input type="checkbox" name="cars[4]" value="1">Car 3 <input type="checkbox" name="cars[5]" value="1">Car 4 Then in the update I loop through: foreach($_POST[cars] as $id=>$value){ //update vehicles set value to yes or no } But, if the unchecked values aren't in $_POST, how do I know to update them??? Thanks!
--- End Message ---
--- Begin Message ---On Tue, Nov 29, 2005 at 10:15:36PM -0500, blackwater dev wrote: > I have a form where I am dynamically building a bunch of checkbox > inputs. Then when submitted, I need to update the db. Problem is, of > course, if the checkbox is unchecked then the $_POST doesn't have the > value in the array. How can I get the value from $_POST even though > it's unchecked? > > For example, here would be the generated form: > > <input type="checkbox" name="cars[2]" value="1">Car 1 > <input type="checkbox" name="cars[3]" value="1">Car 2 > <input type="checkbox" name="cars[4]" value="1">Car 3 > <input type="checkbox" name="cars[5]" value="1">Car 4 > > Then in the update I loop through: > > foreach($_POST[cars] as $id=>$value){ > //update vehicles set value to yes or no > > } This is a good example on how *not* to trust data via form data posted. I'm assuming you have some sort of one to many relation going on: table lot { id int, lot varchar(255) -- Lot 1 } table vehicles { id int, name varchar(255) -- Car 1, Car 2, etc... } table lotvehicle { lot_id int, vehicle_id int, } The form value of cars[X] where X being the id of vehicle and the value of 1 being it is selected (although with the form definition you just want to know if if cars[X] is defined.). So we have a form that will eventually need to knnow what values should be selected. Potentially data alreadly exists that may have the same records. There are two options (or perhaps more) to approach this: Decide as we go approach and clean up: 1) Grap the 'vehicles' currently assoicated with the 'lot' 2) if 'vehicle' is currently selected do nothing 3) if 'vehicle' is a new item we should add 'vehicle' as long as it is a valid 'vehicle; 4) repeat 2 and 3 until we looked at all the data 5) figure out which ones should be deleted and delete them. Forget everything, we'll add what is valid (the lazy way): 1) delete every associated record to the 'lot' 2) for each 'vehicle' add 'vehicle' as long as it is a valid 'vehicle' HTH, Curt. -- cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---I trying to create an absolute path to include scripts and images in another directory. For includes, I have found $path = dirname(__FILE__) ."/mydir/myscript.php"; However, I am unable to reference an image using this path, like echo "<img src=" . dirname(__FILE__) . "/mydir/myimage.gif>"; To reference an image I have to create another path variable which assembles a url like: echo "<img src=http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']) . "/mydir/myimage.gif>"; Is it possible to create just one absolute path variable for both the include and img src= or do I need to create two paths? Thanks cw
--- End Message ---
--- Begin Message ---Chris wrote:I trying to create an absolute path to include scripts and images in another directory.These are two different things, but there is a relationship in the sense that URLs are translated to filesystem paths using document root:http://host/path/to/script.php => [document root]/path/to/script.phpI think it's pretty important to understand the difference as well as the relationship. Once you do, your question might go away.Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/
--- End Message ---
--- Begin Message --------Mensagem original----- De: Jochem Maas (...) the normal way of doing session 'closing' is by way of 'garbage collection' - every now and then a script/process/function is run that 'closes' any sessions which are (according to your criteria) inactive. php has stuff built it that will do this for you to a degree. ----- Is there a way I can access sessions from other users on a script? If yes I could store the session id on a table and later check if isset. Thanks for replying. Pedro.
--- End Message ---
--- Begin Message --------Mensagem original----- De: Jochem Maas (...) the normal way of doing session 'closing' is by way of 'garbage collection' - every now and then a script/process/function is run that 'closes' any sessions which are (according to your criteria) inactive. php has stuff built it that will do this for you to a degree. ----- Is there a way I can access sessions from other users on a script? If yes I could store the session id on a table and later check if isset. Thanks for replying. Pedro.
--- End Message ---
--- Begin Message ---> the normal way of doing session 'closing' is by way of 'garbage collection' > - every now and then a script/process/function is run that 'closes' any > sessions which are (according to your criteria) inactive. php has stuff > built it that will do this for you to a degree. > ----- > > Is there a way I can access sessions from other users on a script? > If yes I could store the session id on a table and later check if isset. You could write the session id into a table when the session is started, along with the start time. Something like sessionid CHAR|starttime DATETIME|lastvisittime DATETIME You could then update this table each time the user visits a page, and delete it if the interval between starttime and lastvisittime is longer than you want. A cron job/scheduled task could be used to clean this table up periodically
--- End Message ---
--- Begin Message ---Mark Rees wrote:the normal way of doing session 'closing' is by way of 'garbagecollection'- every now and then a script/process/function is run that 'closes' any sessions which are (according to your criteria) inactive. php has stuff built it that will do this for you to a degree. ----- Is there a way I can access sessions from other users on a script?what exactly do you mean by that last sentence? I don't quite follow it.If yes I could store the session id on a table and later check if isset.You could write the session id into a table when the session is started, along with the start time. Something like sessionid CHAR|starttime DATETIME|lastvisittime DATETIME You could then update this table each time the user visits a page, and delete it if the interval between starttime and lastvisittime is longer than you want. A cron job/scheduled task could be used to clean this table up periodicallya nice description of 'session garbage collection' :-) .... which is pretty much all you can do in terms of 'logoff'.
--- End Message ---
--- Begin Message ---Hello, on 11/29/2005 10:59 PM Max Schwanekamp said the following:Richard Heyes wrote:Petr Smith wrote:I tried all and ended with http://www.phpguru.org/static/htmlMimeMail5.htmlfast, stable, usable.A very good choice. ;-)But but but, what *is* the advantage of one over the other? I've been a PhpMailer devotee for some time. PEAR::Mail is too spare, PhpMailer is reasonably quick and has proven quite stable (I've built a couple newsletter apps using it). What's the advantage of Richard's package vs. the Pear one (on which he is a lead dev) vs. PhpMailer?Mind me for another opinion. I am not the right person to compare those packages because I do not use them. I use a MIME message class for many years that provides special resources for optimizing deliveries to many recipients like for instance newsletters.Optimizing deliveries depend on the method that you use to deliver the messages. This package provides several different delivery methods that are implemented by different sub-classes in the package: mail(), sendmail, qmail, SMTP, Windows pickup folder.You can tell the class to optimize the queueing of the messages for many recipients just by calling the function SetBulkMail(). Then whatever is the sub-class of the delivery method that you use, it will set its mode of operation to minimize the time that your script has to wait to queue all the messages to your recipients.Furthermore, if your message body are the same for all the newsletter recipients, the class can cache the message body so it will not waste time rebuilding the message to all users.All these techniques provide huge speedup. I use this package for many years. Currently it is used to send about 3.5 million newsletters a month and I can tell you that it is very fast queuing around 30 messages per second in a qmail based setup, all done in pure PHP code.http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos Metastorage - Data object relational mapping layer generator http://www.metastorage.net/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/
--- End Message ---
--- Begin Message ---On Tue, Nov 29, 2005 at 04:59:55PM -0800, Max Schwanekamp wrote: > Richard Heyes wrote: > >Petr Smith wrote: > >>I tried all and ended with > >>http://www.phpguru.org/static/htmlMimeMail5.html > >>fast, stable, usable. > >A very good choice. ;-) > > But but but, what *is* the advantage of one over the other? I've been a > PhpMailer devotee for some time. PEAR::Mail is too spare, PhpMailer is > reasonably quick and has proven quite stable (I've built a couple > newsletter apps using it). What's the advantage of Richard's package > vs. the Pear one (on which he is a lead dev) vs. PhpMailer? First off, the OT is rather to general to really know what is going to be better, the only way to resolve it is to benchmark the results, if you are sending one message heh.. good luck figuring that out. What i would be looking for is if there are tools to manage a mailman list or ezlm list, i'd rather have an application that is designed for sending out bulk emails than try to figure out what is the best php Mail/STMP interface to send email to an MTA that will most likely be the bottleneck anyway. As for speed, you will most likly have a issues with the actual STMP server or the MTA trying to send the documents. Even if you speed up on how fast php can send email to a STMP server directly or inject the messages to the MTA, the messages can only be sent as fast as they can be delivered, thus any effort to make php sending mail faster is rather futile. Curt. -- cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---Hi List,I have some mysql table data that i would like to display back to the web user in a neat and tidy way using php.Data: col1 col2 col3 test 1.99 F test 1.99 F test 1.99 F test 0.99 F test 1.99 F bang 2.99 F bang 3.99 F bang 4.49 F bang 2.99 F bang 2.99 F Table display i am hoping to display: First the unique name of col1 as a header <table><tr><td>test</td><td>bang</td></tr></table>Second a row each for each col2 and col3 where header above = col1 so the finished table looks like thistest bang 1.99 F 2.99 F 1.99 F 3.99 F 1.99 F 4.49 F 0.99 F 2.99 F 1.99 F 2.99 F I will really appreiciate and help you may give with this question. Thank you in advance Dave C
--- End Message ---
--- Begin Message ---First of all this is not automatic. You can do this with a foreach loop. If you want nice presentations, you might as well try http://smarty.php.net "Dave Carrera" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi List, > > I have some mysql table data that i would like to display back to the > web user in a neat and tidy way using php. > > Data: > > col1 col2 col3 > test 1.99 F > test 1.99 F > test 1.99 F > test 0.99 F > test 1.99 F > bang 2.99 F > bang 3.99 F > bang 4.49 F > bang 2.99 F > bang 2.99 F > > Table display i am hoping to display: > First the unique name of col1 as a header > > <table><tr><td>test</td><td>bang</td></tr></table> > > Second a row each for each col2 and col3 where header above = col1 so > the finished table looks like this > > test bang > 1.99 F 2.99 F > 1.99 F 3.99 F > 1.99 F 4.49 F > 0.99 F 2.99 F > 1.99 F 2.99 F > > I will really appreiciate and help you may give with this question. > > Thank you in advance > > Dave Csmime.p7s
Description: S/MIME cryptographic signature
--- End Message ---
--- Begin Message ---On Tue, Nov 29, 2005 at 09:31:25AM +0100, Petr Smith wrote: > Run two Apache servers, second (with old PHP version) on another port. > Internally forward all requests to old PHP project to this second server. you know I almost suggested this method, the only problem i had with this is that well if the proxied server is busy it causes extra load on the main server (due to the multiple requests) > > We tested most methods but this was the best. I've only set up this situation for development purposes. It would be intersting how apache performs against proxy request vs having a module requested on a different port. One thing that i know could be a factor is memory usage. Curt. -- cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---On Tue, Nov 29, 2005 at 11:57:49AM -0500, Jim Moseby wrote: > > Hi to all! > > I have form made on 4 pages (by groups of questions). Right > > now my code > > works this way: once somebody submit the first page of the > > form his/her > > submitted info is entered in database with status=temp. I > > store the ID > > (insert_id()) in session and then every time visitor submit the next > > page I do update of the current record using ID. > > But, I heard once that "the best" solution is store all > > entered info in > > session (array) and insert all info at once. > > Or, instead in sessions, move submitted info with serialized array. > > > > Opinions? > > > > The upside to storing the data in session variables is that you make only ne > DB call at the end, saving processor, bandwidth, etc. The downside is, that > if your user cannot complete the form, his data is lost and he has to start > all over again. Another upside is that you dont have to maintain old session data, it is done for you. If the user comes to your site and just does 3 of the 4 pages, you dont have to worry about cleaning up any extra dead information. Curt. -- cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---On Wed, Nov 30, 2005 at 06:06:18AM +0530, ganu wrote: > Hi all , > > I have a problem , when I am migrating my data from http://www.abc.com > <http://www.abc.com/> to https://www.abc.com <https://www.abc.com/> for > secure login purpose. I will loose all my data which I store in my session. How do you mean by migrate? If you are using the default setup for sessions (of course pending how you installed), going from unsecure to secure shouldn't be a problem, assuming this is all on the same machine. > if suppose I am able to do it from http to https then from https to http > I am getting the problem. moving from https to http can be a different storry, if the php.ini setting for session.cookie_secure is set, then cookies* with the https wont be accpeted when going to http. * assuming that you are using php.ini: session.use_cookies. Curt. -- cat .signature: No such file or directory
--- End Message ---
--- Begin Message ---Hi. Is possible to calculate the filesize of image that will result from using imagejpeg without actually writing to disk? Thanks :)
--- End Message ---
--- Begin Message ---Karuna wrote:Hi. Is possible to calculate the filesize of image that will result from using imagejpeg without actually writing to disk? Thanks :)something like (although its not very efficient, I think): ob_start(); image_jpeg($im); // $im is an GD resource $data = ob_get_contents(); ob_end_clean; $byteCount = strlen($data);
--- End Message ---
--- Begin Message ---Not efficient, because the actual size on the disk depends on the filesystem. I don't think you can find out before writing it to the disk "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Karuna wrote: > > Hi. Is possible to calculate the filesize of image that will result from > > using imagejpeg without actually writing to disk? > > > > Thanks :) > > > > something like (although its not very efficient, I think): > > ob_start(); > image_jpeg($im); // $im is an GD resource > $data = ob_get_contents(); > ob_end_clean; > > $byteCount = strlen($data);smime.p7s
Description: S/MIME cryptographic signature
--- End Message ---
--- Begin Message ---Ciprian Constantinescu wrote:Not efficient, because the actual size on the disk depends on the filesystem. I don't think you can find out before writing it to the diskexcuse me but: 1. the OP asked for the size of the file, not the number of bytes it takes up on disk (which are eaten up in fixed increments aka clusters) - then again chances are the OP didn't consider that there may be a difference, so he'll have to figure out which of the 2 number is actually important to him. 2. you don't seem to know what 'efficient' means, generating a wrong (in your opinion) size consitutes wrongness not inefficiency. I called it inefficient because it requires that the whole file is read into php's memoryspace."Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]Karuna wrote:Hi. Is possible to calculate the filesize of image that will result from using imagejpeg without actually writing to disk? Thanks :)something like (although its not very efficient, I think): ob_start(); image_jpeg($im); // $im is an GD resource $data = ob_get_contents(); ob_end_clean; $byteCount = strlen($data);
--- End Message ---
--- Begin Message ---Hi.. Any body recomend a good MVC platform that is easy to work with, and build on... I'm looking at cakephp, solar, php on trax.. Anything better out there. -- Gregory Machin [EMAIL PROTECTED] [EMAIL PROTECTED] www.linuxpro.co.za www.exponent.co.za Web Hosting Solutions Scalable Linux Solutions www.iberry.info (support and admin) +27 72 524 8096
--- End Message ---
--- Begin Message ---Have a look at http://znf.zeronotice.com/ this framework is young but very good and easy to use. It's written in PHP5 and supports also PDO. On Wednesday 30 November 2005 12:04, Gregory Machin wrote: > Hi.. > Any body recomend a good MVC platform that is easy to work with, and build > on... > I'm looking at cakephp, solar, php on trax.. > > Anything better out there. > -- > Gregory Machin > [EMAIL PROTECTED] > [EMAIL PROTECTED] > www.linuxpro.co.za > www.exponent.co.za > Web Hosting Solutions > Scalable Linux Solutions > www.iberry.info (support and admin) > > +27 72 524 8096 -- Fabiano Ricci HomePage --:. http://www.stalsy.it Blog --:. http://blog.stalsy.com Public Key --:. http://www.stalsy.it/key.php E-Mail --:. [EMAIL PROTECTED] || [EMAIL PROTECTED] ICQ --:. 302346155 MSN --:. [EMAIL PROTECTED]pgpJu7ZQUuoog.pgp
Description: PGP signature
--- End Message ---
--- Begin Message ---Hi , I'm trying to move some mail from one dir to another: $mbox=imap_open(...); imap_mail_move($mbox,"2","INBOX,Sent") or die (imap_last_error()); I get this error : error in imap command received by server . I'm not sure what this error means. Any suggestions? Thanks in advance.
--- End Message ---
--- Begin Message ---$sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE nameOfPedigree like '\'%' "; Maybe this could work... -- "El único error real es aquel en el que no hemos aprendido nada."
--- End Message ---
--- Begin Message ---The ' character has to be escaped. Try using \' ""Gustav Wiberg"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi > > I'm sorry but this didn't work either? If I replaced the ' with for example > an a it worked > > /G > > ----- Original Message ----- > From: "Stephen Johnson" <[EMAIL PROTECTED]> > To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" > <php-general@lists.php.net> > Sent: Tuesday, November 29, 2005 10:00 PM > Subject: Re: [PHP] Howto search in SQL for a specific character? > > > > Try this : > > > > $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE nameOfPedigree like > > "'%"; > > > > The % is a wildcard and will give you the results you want. > > > > > > <?php > > /* > > > > Stephen Johnson c | eh > > The Lone Coder > > > > http://www.ouradoptionblog.com > > Join our journey of adoption > > > > http://www.thelonecoder.com > > [EMAIL PROTECTED] > > > > continuing the struggle against bad code > > > > */ > > ?> > > > > > >> From: Gustav Wiberg <[EMAIL PROTECTED]> > >> Organization: Gustav Wiberg > >> Reply-To: Gustav Wiberg <[EMAIL PROTECTED]> > >> Date: Tue, 29 Nov 2005 21:55:27 +0100 > >> To: PHP General <php-general@lists.php.net> > >> Subject: [PHP] Howto search in SQL for a specific character? > >> > >> Hi there! > >> > >> in PHP i Write.. > >> > >> > >> $v1 = chr(39); //39 is apostrofe > >> > >> > >> $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE > >> SUBSTR(nameOfPedigree,0,1) = $v1"; > >> > >> Why doesn't this work? > >> > >> I want the sql to select all nameOfPedigree - fields where the first > >> character is apostrofe (') > >> > >> /G > >> http://www.varupiraten.se/ > >> > >> -- > >> PHP General Mailing List (http://www.php.net/) > >> To unsubscribe, visit: http://www.php.net/unsub.php > >> > > > > > >smime.p7s
Description: S/MIME cryptographic signature
--- End Message ---
--- Begin Message ---Gustav Wiberg wrote: > >> $v1 = chr(39); //39 is apostrofe > >> > >> > >> $sql = "SELECT nameOfPedigree FROM tbpedigrees WHERE > >> SUBSTR(nameOfPedigree,0,1) = $v1"; > >> > >> Why doesn't this work? > >> > >> I want the sql to select all nameOfPedigree - fields where the first > >> character is apostrofe (') Here is what I have done using MySQL: ** Create a table: mysql> CREATE TABLE `tablename` ( -> `id` tinyint(3) unsigned NOT NULL auto_increment, -> `name` char(20) default '0', -> PRIMARY KEY (`id`) -> ); Query OK, 0 rows affected (0.06 sec) ** Then insert some data into the table: mysql> INSERT INTO tablename (id, name) VALUES (NULL, '\'Albert'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO tablename (id, name) VALUES (NULL, '\'Piet'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO tablename (id, name) VALUES (NULL, '\'Koos'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO tablename (id, name) VALUES (NULL, 'Jan'); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO tablename (id, name) VALUES (NULL, 'Gert'); Query OK, 1 row affected (0.00 sec) ** Then retrieve all the record starting with an apostrophe ('): mysql> SELECT * FROM tablename WHERE name LIKE '\'%'; +----+---------+ | id | name | +----+---------+ | 1 | 'Albert | | 2 | 'Piet | | 3 | 'Koos | +----+---------+ 3 rows in set (0.00 sec) Hope it helps Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.10/188 - Release Date: 2005/11/29
--- End Message ---
--- Begin Message ---I have two images which I want to overlay on each other. Image1 is a satellite image. Image2 is contains the statistical data we collected. It has a transparent background and should be overlaid on top of the satellite image. Both are in PNG format. My current code: <? $dataImage = imagecreate(1000, 1000); $dIBack = imagecolorallocate($dataImage, 199, 199, 199); imagecolortransparent($dataImage, $dIBack); $darkGreen = imagecolorallocate($tileImage, 2, 123, 48 ); $grey = imagecolorallocate($tileImage, 118, 131, 120); $fuchsia = imagecolorallocate($tileImage, 255, 0, 255); $aqua = imagecolorallocate($tileImage, 113, 168, 194); $brown = imagecolorallocate($tileImage, 177, 170, 107); $offwhite = imagecolorallocate($tileImage, 187, 210, 193); $black = imagecolorallocate($tileImage, 0, 0, 0 ); $blue = imagecolorallocate($tileImage, 0, 0, 255); $red = imagecolorallocate($tileImage, 255, 0, 0 ); $yellow = imagecolorallocate($tileImage, 255, 255, 0 ); /* Code to draw data on image comes here */ $satImage = imagecreatefrompng(sat_image.png); $mergedImage = imagecreate(1000, 1000); imagealphablending($mergedImage, true); imagecopy($mergedImage, $satImage, 0, 0, 0, 0, 1000, 1000); imagecopy($mergedImage, $dataImage, 0, 0, 0, 0, 1000, 1000); imagepng($mergedImage, merged_image.png); imagedestroy($mergedImage); imagedestroy($satImage); imagedestroy($dataImage); ?> Notes: 1. When using imagecreatetruecolor the images turn black 2. When using imagealphablending = true or imagealphablending = false with imagecopy the result is the same. The top image is shown but it is almost transparent. Some images are also discoloured. 3. When using imagecopymerge to copy with a pct value of 99, and commenting out the imagealphablending line the top image does not appear at all 4. When using imagecopymerge to copy with a pct value of 99, and imagealphablending=true, it has the same result as 2. above. 5. When using imagecopymerge to copy with a pct value of 50, and Imagealphablending=true, it has the same result as 2. above. What is the effect of the pct value of imagecopymerge? Should I be using different values for the pct value of imagecopymerge or is there an alternative method which will do what I want to be done? It seems to me that the palette used in the top image is not merged with the palette used in the satellite image. Albert -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.362 / Virus Database: 267.13.10/188 - Release Date: 2005/11/29
--- End Message ---