Re: [PHP] File To Blob Corruption
On Sun, 2009-11-15 at 16:43 +1300, German Geek wrote: > Hi, Could it have something to do with an eof character being encoded or > something like that? Do you really need to store the files in the DB? It > uses more processing power if stored in the DB because on retrieval, you > have to unescape the string and return it. Modern filesystems are optimised > better for files than databases and storing a filename and returning the > contents is easier to implement than retrieving it from the DB... > > http://forums.codewalkers.com/php-applications-45/upload-image-file-to-mysql-as-blob-849194.html > > ++Tim Hinnerk Heuer++ > > http://www.ihostnz.com > > > 2009/11/15 Don Wieland > > > Hello, > > > > I am trying to create an UPLOAD page to Update a Images and PDFs into a > > BLOB field in mySQL. The image keeps getting corrupted (it draws a portion > > of the image and the rest is GRAY) We tried it with Safari and Firefox with > > bad results. > > > > Here is the form that is used to browse and select the file. > > > > > > > > > > > > Upload Thumbnail image > > > > Please select the thumbnail image, then press Upload. > > > style="margin-top:14px;margin-bottom:14px;text-align:center;width:100%"> > > > enctype="multipart/form-data"> > > Select Thumbnail: > accept="image/jpeg" /> > > > > > > > onclick="saveDialog('uploadImage','img','jpg');"> > value="Cancel" onclick="cancelDialog('uploadImage','img')"> > > > > > > > > > > Here is the QUERY to upload the image (saveDialog.php): > > > > if($_POST['obj'] == "uploadImage") { > > $file = > > $db->real_escape_string(file_get_contents($_FILES['img']['tmp_name'])); > > $db->query("UPDATE Areas SET Image = '$file'") or die("1".$db->error); > > > > Has anyone else ever run into this type of UPDATE error with images and > > PDF? We really need to get this dealt with ASAP. > > > > Thanks! > > > > Don Wieland > > D W D a t a C o n c e p t s > > ~ > > d...@dwdataconcepts.com > > Direct Line - (949) 305-2771 > > > > Integrated data solutions to fit your business needs. > > > > Need assistance in dialing in your FileMaker solution? Check out our > > Developer Support Plan at: > > http://www.dwdataconcepts.com/DevSup.html > > > > Appointment 1.0v9 - Powerful Appointment Scheduling for FileMaker Pro 9 or > > higher > > http://www.appointment10.com > > > > For a quick overview - > > http://www.appointment10.com/Appt10_Promo/Overview.html > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > Like someone mentioned on the link you posted; storing the images in the database does offer a layer of security, as database access is far easier to control than file access. Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Shoutbox suggestion needed
Hello, I just want to implement a shoutbox script for an e-learning application. Searched Google for possible solutions but I just want to know what other developers use. AJAX and GPL is a must. Thanks. --- “Talk is cheap. Show me the code” - Linus Torvalds
Re: [PHP] is Aptana taking a crap on the face of PHP?
> > * It is FREE (unlike Zend's retarded $500 price tag). I bought Zend Studio back in the 5.5 days - a couple of months after that they announced they were dropping support for the standalone IDE and made Studio an Eclipse plugin. It was then they added about $200 to the price. I moved to NuSphere PhpEd and was happy with that for a couple of years, now I'm on a Mac and haven't been able to find a decent IDE for either PHP or C++. Apple's Xcode seems to do the job for C++ (although better code completion wouldn't go a miss) but it fails miserably with PHP. Komodo was great for PHP but quite often it kept failing to load my class definitions for the code completion (and kept my processor sat at 25% use the whole time it was running.) I thought NetBeans was Java-only (and proprietary) but evidently it's come a long way since I last looked at it - I'm just downloading it now to see if it will handle both PHP and C++. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Developer needed in Rome, Italy
Hi All, I'm looking for a PHP MySQL JavaScript CSS HTML developer, full time, in Rome, Italy. Laurentina area. Qualification is not compulsory (degree ... certification ...) and can be first experience. Ability to read English is a requirement (so that the candidate can benefit studying real world documentation). Example of previous jobs are welcome even if they are amateur. References are a plus. Please contact me off-list. Regards and have a nice evening, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fread() memory problems
I was just wondering why fread() seems to use so much memory when reading in a file. My php.ini has a script memory limit of 32MB, yet PHP hits its memory limit on a 19MB mbox file that I'm reading in. How is it possible that this function can use 150% of a files' size in memory?! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] mail mimedecode with multiple mails in one mbox file
Hi all, I'm having a bit of difficulty seeing my way through this. I think I'm on the right path with mimeDecode, but I can't get it to read all of the emails in an mbox file which contains 100 emails; it only reads the first. I've looked over the docs on pear.php.net, but can't seem to find any way to get the other 99 emails out! Does anyone know of any way to do this, or have you done something similar another way? Just to clarify, I won't be connecting to an external mailbox for this, so it has to be something I can use on a local mbox file. Ps, sorry to anyone who thinks bad of me for opening two threads at once, but they are quite separate, and valid, and contrary to popular belief, us men *can* actually multitask! Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] mail mimedecode with multiple mails in one mbox file
Ashley Sheridan wrote: > Hi all, > > I'm having a bit of difficulty seeing my way through this. I think I'm > on the right path with mimeDecode, but I can't get it to read all of > the emails in an mbox file which contains 100 emails; it only reads > the first. > > I've looked over the docs on pear.php.net, but can't seem to find any > way to get the other 99 emails out! > > Does anyone know of any way to do this, Look up "formail -s" /Per -- Per Jessen, Zürich (9.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail mimedecode with multiple mails in one mbox file
On Sun, 2009-11-15 at 20:54 +0100, Per Jessen wrote: > Ashley Sheridan wrote: > > > Hi all, > > > > I'm having a bit of difficulty seeing my way through this. I think I'm > > on the right path with mimeDecode, but I can't get it to read all of > > the emails in an mbox file which contains 100 emails; it only reads > > the first. > > > > I've looked over the docs on pear.php.net, but can't seem to find any > > way to get the other 99 emails out! > > > > Does anyone know of any way to do this, > > Look up "formail -s" > > > /Per > > -- > Per Jessen, Zürich (9.0°C) > > Thanks, that's got me going in the right direction! There just seems to be no end to what you can do on a Linux console does there?! Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] this has got me baffled: imagesx() and imagesy() reporting the wrong size?
On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] this has got me baffled: imagesx() and imagesy() reporting the wrong size?
On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: > On my site I have a web form for users to upload graphics, however there > are constraints on the size allowed. Recently, a user has been having > problems, because the code is reporting the wrong size - a size too > small to be allowed! They sent me a copy of the image so I could > confirm the error, and I have: even though the image is a 32x32 image > (2-frame animated GIF, if it matters), imagesx() and imagesy() report > that the image is 30x24! I have never had this problem before (or, at > least, no one has reported it to me) so I'm tempted to think that it's a > bug in PHP, or (more likely) I am missing something crucial... > > The relevant code: > > if($itype == 'image/gif') >$img = imagecreatefromgif($_FILES['file']['tmp_name']); > else if($itype == 'image/png' || $itype == 'image/x-png') >$img = imagecreatefrompng($_FILES['file']['tmp_name']); > > // note: we do not get here if($itype != 'image/gif' && $itype != > // 'image/png' && $itype != 'image/x-png'), so the problem should not > // lie with an image type we were not expecting > > $w = imagesx($img); > $h = imagesy($img); > > if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) > { >$error = 'The graphic\'s dimensions are not correct (' . > $w . 'x' . $h . ').'; > } > else > { >... > } > > yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. > > I'd be happy to link the animated GIF in question... just in case there > was a problem with the GIF itself, I tried opening it up in an (old) > version of Fireworks, and re-exporting it, but the problem remains. > > besides the possibility of a bug in PHP, I'm wondering if I need to > handle animated GIFs differently, or something like that? but again, > this code has been running for... 3ish years without a problem like this > ever being reported... quite confusing. > If you could link the gif I think that would help. Also, just to point out, the comment in the script is wrong, if the image is neither png or gif, the rest of the script will still be parsed. The if logic is like this: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); everything after that is executed perhaps you wanted something like this: if($itype == 'image' || $itype == 'image/png' || $itype == 'image/x-png') { if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // execute the rest of the image checking script } Thanks, Ash http://www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lightweight web server for Windows?
What do people on this list use as an ultra-lightweight web server (with PHP capability of course) on Windows? I have an old but still well functioning laptop that I have just given a second life by installing Windows Fundamentals (a stripped down version of XP). This works surprisingly well. So now I am looking for the necessary software, so I can do some local programming. Some requirements I can think of: - Extremely small memory footprint and fast efficient code. This laptop still works well but it can certainly use some help! - Both free as in beer and free as in speech would be my preference. - Be able to run as a "service" in XP. - Be able to run PHP (obviously) and perhaps a few other nice server features, like SSI and name based virtual hosts. Any suggestions? I have not seriously used Windows for years now, so my knowledge of that platform is not exactly up to date anymore. I am used to dealing with Debian/Ubuntu Linux and Apache but not much else, frankly. Apache does seem to heavy for this. My initial thought was to install Lighttpd under Cygwin, but perhaps I would be missing out on some great little server program that I have not yet heard about. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] this has got me baffled: imagesx() and imagesy()reporting the wrong size?
Ashley Sheridan wrote: On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. If you could link the gif I think that would help. Also, just to point out, the comment in the script is wrong, if the image is neither png or gif, the rest of the script will still be parsed. The if logic is like this: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); everything after that is executed perhaps you wanted something like this: if($itype == 'image' || $itype == 'image/png' || $itype == 'image/x-png') { if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // execute the rest of the image checking script } Thanks, Ash http://www.ashleysheridan.co.uk what I meant by the comment, is that that previous code DOES exist... to assure you that the problem isn't in having $img unset, or something along those lines. (I added in the comment after the fact.) I have uploaded the image causing the problem here: www.telkoth.net/temp/radioactive-bread-eek.gif I should also add: I have ended up working around the problem by using getimagesize() instead; that function is reporting the correct width and height. this furthers my belief that there's a bug somewhere with imagesx(), imagesy() or imagecreatefromgif()... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help needed with calculation
Hi everyone, I'm not sure of the correct formula for this, if I have a file - just for example, that is 10245458756 bytes long and the download speed is 60KB a second, what formula would I use to calculate how many seconds/minutes/hours it would take to download the file? Maths really isn't my strong point and formulas go over my head otherwise I wouldn't ask :-( Thanks everyone Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: File To Blob Corruption
On Sat, 14 Nov 2009 17:39:20 -0800, Don Wieland wrote: > Hello, > > I am trying to create an UPLOAD page to Update a Images and PDFs into > a BLOB field in mySQL. The image keeps getting corrupted (it draws a > portion of the image and the rest is GRAY) We tried it with Safari and > Firefox with bad results. > > Here is the QUERY to upload the image (saveDialog.php): > > if($_POST['obj'] == "uploadImage") { > $file = $db->real_escape_string(file_get_contents($_FILES['img'] > ['tmp_name'])); > $db->query("UPDATE Areas SET Image = '$file'") or die("1".$db->error); Random ideas: * Select the image from the database and compare it to $file. Are they identical? * Run a hex dump on the images before and after upload. What is the difference? /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help needed with calculation
Chris Payne wrote: Hi everyone, I'm not sure of the correct formula for this, if I have a file - just for example, that is 10245458756 bytes long and the download speed is 60KB a second, what formula would I use to calculate how many seconds/minutes/hours it would take to download the file? Maths really isn't my strong point and formulas go over my head otherwise I wouldn't ask :-( Thanks everyone Chris $size = 1024548756; // in bytes $kb_per_sec = 60; // I assume you'll fill these in from elsewhere? $b_per_sec = $kb_per_sec * 1024; $seconds = $size / $b_per_sec; $minutes = 0; $hours = 0; if($seconds > 60) { // 60 seconds to a minute $minutes = (int)($seconds / 60); $seconds -= $minutes * 60; if($minutes > 60) { // 60 minutes to an hour $hours = (int)($minutes / 60); $minutes -= $hours * 60; // if you want to go further and calculate days, have at :) } } You could also approach this using modulus, but if you're not confident with math, this might be a more intuitive approach. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help needed with calculation
If the download speed is constant (linear) then you can just use. (10245458756 / 6t)/1000 = kb/second or (10245458756 / 6t)/6 = kb/minute The general form would be. (size_of_file / download_speed * time) / convert_to_units Where t (or time) is the amount of seconds that the download has been active. On Sun, Nov 15, 2009 at 15:39, Chris Payne wrote: > Hi everyone, > > I'm not sure of the correct formula for this, if I have a file - just > for example, that is 10245458756 bytes long and the download speed is > 60KB a second, what formula would I use to calculate how many > seconds/minutes/hours it would take to download the file? > > Maths really isn't my strong point and formulas go over my head > otherwise I wouldn't ask :-( > > Thanks everyone > > Chris > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- - Adam Shannon ( http://ashannon.us ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] this has got me baffled: imagesx() and imagesy()reporting the wrong size?
On Sun, 2009-11-15 at 16:25 -0500, Ben wrote: > Ashley Sheridan wrote: > > On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: > >> On my site I have a web form for users to upload graphics, however there > >> are constraints on the size allowed. Recently, a user has been having > >> problems, because the code is reporting the wrong size - a size too > >> small to be allowed! They sent me a copy of the image so I could > >> confirm the error, and I have: even though the image is a 32x32 image > >> (2-frame animated GIF, if it matters), imagesx() and imagesy() report > >> that the image is 30x24! I have never had this problem before (or, at > >> least, no one has reported it to me) so I'm tempted to think that it's a > >> bug in PHP, or (more likely) I am missing something crucial... > >> > >> The relevant code: > >> > >> if($itype == 'image/gif') > >>$img = imagecreatefromgif($_FILES['file']['tmp_name']); > >> else if($itype == 'image/png' || $itype == 'image/x-png') > >>$img = imagecreatefrompng($_FILES['file']['tmp_name']); > >> > >> // note: we do not get here if($itype != 'image/gif' && $itype != > >> // 'image/png' && $itype != 'image/x-png'), so the problem should not > >> // lie with an image type we were not expecting > >> > >> $w = imagesx($img); > >> $h = imagesy($img); > >> > >> if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) > >> { > >>$error = 'The graphic\'s dimensions are not correct (' . > >> $w . 'x' . $h . ').'; > >> } > >> else > >> { > >>... > >> } > >> > >> yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. > >> > >> I'd be happy to link the animated GIF in question... just in case there > >> was a problem with the GIF itself, I tried opening it up in an (old) > >> version of Fireworks, and re-exporting it, but the problem remains. > >> > >> besides the possibility of a bug in PHP, I'm wondering if I need to > >> handle animated GIFs differently, or something like that? but again, > >> this code has been running for... 3ish years without a problem like this > >> ever being reported... quite confusing. > >> > > > > If you could link the gif I think that would help. > > > > Also, just to point out, the comment in the script is wrong, if the > > image is neither png or gif, the rest of the script will still be > > parsed. The if logic is like this: > > > > if($itype == 'image/gif') > > $img = imagecreatefromgif($_FILES['file']['tmp_name']); > > else > > if($itype == 'image/png' || $itype == 'image/x-png') > > $img = imagecreatefrompng($_FILES['file']['tmp_name']); > > > > > > > > everything after that is executed > > > > perhaps you wanted something like this: > > > > if($itype == 'image' || $itype == 'image/png' || $itype == > > 'image/x-png') > > { > > if($itype == 'image/gif') > > $img = imagecreatefromgif($_FILES['file']['tmp_name']); > > if($itype == 'image/png' || $itype == 'image/x-png') > > $img = imagecreatefrompng($_FILES['file']['tmp_name']); > > > > // execute the rest of the image checking script > > } > > > > > > Thanks, > > Ash > > http://www.ashleysheridan.co.uk > > > > > > > > what I meant by the comment, is that that previous code DOES exist... to > assure you that the problem isn't in having $img unset, or something > along those lines. (I added in the comment after the fact.) > > I have uploaded the image causing the problem here: > www.telkoth.net/temp/radioactive-bread-eek.gif > > I should also add: I have ended up working around the problem by using > getimagesize() instead; that function is reporting the correct width and > height. this furthers my belief that there's a bug somewhere with > imagesx(), imagesy() or imagecreatefromgif()... > It does indeed seem to be some sort of bug. I've just tested it with your image on my machine here and for imagesx() and imagesy() it gives 30 and 24 respectively. getimagesize() does return the correct dimensions though. The same image saved as a flat single layer gif from the Gimp behaves exactly the same way. This might not be a proper bug as such, as the image itself might be 32x32, but the first layer (the first frame in the animated version) is 30x24 when you remove the dead, unused, transparent background. Perhaps GD is meant to report on the *actual* size of the image, rather than the dimensions of the frame? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] this has got me baffled: imagesx() andimagesy()reporting the wrong size?
Ashley Sheridan wrote: On Sun, 2009-11-15 at 16:25 -0500, Ben wrote: Ashley Sheridan wrote: On Sun, 2009-11-15 at 15:07 -0500, Ben wrote: On my site I have a web form for users to upload graphics, however there are constraints on the size allowed. Recently, a user has been having problems, because the code is reporting the wrong size - a size too small to be allowed! They sent me a copy of the image so I could confirm the error, and I have: even though the image is a 32x32 image (2-frame animated GIF, if it matters), imagesx() and imagesy() report that the image is 30x24! I have never had this problem before (or, at least, no one has reported it to me) so I'm tempted to think that it's a bug in PHP, or (more likely) I am missing something crucial... The relevant code: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // note: we do not get here if($itype != 'image/gif' && $itype != // 'image/png' && $itype != 'image/x-png'), so the problem should not // lie with an image type we were not expecting $w = imagesx($img); $h = imagesy($img); if(!(($w == 48 && $h == 48) || ($w >= 4 && $w <= 48 && $h == 32))) { $error = 'The graphic\'s dimensions are not correct (' . $w . 'x' . $h . ').'; } else { ... } yes, the logic wants either a 48x48 graphic, or a 4x32 to 48x32 graphic. I'd be happy to link the animated GIF in question... just in case there was a problem with the GIF itself, I tried opening it up in an (old) version of Fireworks, and re-exporting it, but the problem remains. besides the possibility of a bug in PHP, I'm wondering if I need to handle animated GIFs differently, or something like that? but again, this code has been running for... 3ish years without a problem like this ever being reported... quite confusing. If you could link the gif I think that would help. Also, just to point out, the comment in the script is wrong, if the image is neither png or gif, the rest of the script will still be parsed. The if logic is like this: if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); else if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); everything after that is executed perhaps you wanted something like this: if($itype == 'image' || $itype == 'image/png' || $itype == 'image/x-png') { if($itype == 'image/gif') $img = imagecreatefromgif($_FILES['file']['tmp_name']); if($itype == 'image/png' || $itype == 'image/x-png') $img = imagecreatefrompng($_FILES['file']['tmp_name']); // execute the rest of the image checking script } Thanks, Ash http://www.ashleysheridan.co.uk what I meant by the comment, is that that previous code DOES exist... to assure you that the problem isn't in having $img unset, or something along those lines. (I added in the comment after the fact.) I have uploaded the image causing the problem here: www.telkoth.net/temp/radioactive-bread-eek.gif I should also add: I have ended up working around the problem by using getimagesize() instead; that function is reporting the correct width and height. this furthers my belief that there's a bug somewhere with imagesx(), imagesy() or imagecreatefromgif()... It does indeed seem to be some sort of bug. I've just tested it with your image on my machine here and for imagesx() and imagesy() it gives 30 and 24 respectively. getimagesize() does return the correct dimensions though. The same image saved as a flat single layer gif from the Gimp behaves exactly the same way. This might not be a proper bug as such, as the image itself might be 32x32, but the first layer (the first frame in the animated version) is 30x24 when you remove the dead, unused, transparent background. Perhaps GD is meant to report on the *actual* size of the image, rather than the dimensions of the frame? Thanks, Ash http://www.ashleysheridan.co.uk ! interesting (that it's doing some kind of trimming). it hadn't occurred to me that it might be doing that. if that's the case, and intended behavior of these functions, I feel like it should definitely be mentioned somewhere on php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail mimedecode with multiple mails in one mbox file
Hello, on 11/15/2009 05:22 PM Ashley Sheridan said the following: > Hi all, > > I'm having a bit of difficulty seeing my way through this. I think I'm > on the right path with mimeDecode, but I can't get it to read all of the > emails in an mbox file which contains 100 emails; it only reads the > first. > > I've looked over the docs on pear.php.net, but can't seem to find any > way to get the other 99 emails out! > > Does anyone know of any way to do this, or have you done something > similar another way? Just to clarify, I won't be connecting to an > external mailbox for this, so it has to be something I can use on a > local mbox file. The mbox format is not exactly compatible with the regular MIME message format. Anyway, you may use the MIME parser class which supports parsing single MIME messages as well multi-message messages in the mbox format. Just set the mbox class variable to 1. http://www.phpclasses.org/mimeparser -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Lightweight web server for Windows?
Try nginx (http://nginx.net/), very light, has a Windows binary distribution and can be configured easily for PHP. You can also find some version of Lighttpd compiled for Windows and skip the compilation troubles, and you can use this: http://sites.google.com/site/lightytray/ to control the webserver. Both of them are lighter than Apache. Good luck, Jonathan On Sun, Nov 15, 2009 at 6:00 PM, O. Lavell wrote: > What do people on this list use as an ultra-lightweight web server (with > PHP capability of course) on Windows? I have an old but still well > functioning laptop that I have just given a second life by installing > Windows Fundamentals (a stripped down version of XP). This works > surprisingly well. So now I am looking for the necessary software, so I > can do some local programming. > > Some requirements I can think of: > > - Extremely small memory footprint and fast efficient code. This laptop > still works well but it can certainly use some help! > - Both free as in beer and free as in speech would be my preference. > - Be able to run as a "service" in XP. > - Be able to run PHP (obviously) and perhaps a few other nice server > features, like SSI and name based virtual hosts. > > Any suggestions? I have not seriously used Windows for years now, so my > knowledge of that platform is not exactly up to date anymore. I am used > to dealing with Debian/Ubuntu Linux and Apache but not much else, > frankly. Apache does seem to heavy for this. My initial thought was to > install Lighttpd under Cygwin, but perhaps I would be missing out on some > great little server program that I have not yet heard about. > > -- > 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] Re: Lightweight web server for Windows?
Hello, on 11/15/2009 07:00 PM O. Lavell said the following: > What do people on this list use as an ultra-lightweight web server (with > PHP capability of course) on Windows? I have an old but still well > functioning laptop that I have just given a second life by installing > Windows Fundamentals (a stripped down version of XP). This works > surprisingly well. So now I am looking for the necessary software, so I > can do some local programming. > > Some requirements I can think of: > > - Extremely small memory footprint and fast efficient code. This laptop > still works well but it can certainly use some help! > - Both free as in beer and free as in speech would be my preference. > - Be able to run as a "service" in XP. > - Be able to run PHP (obviously) and perhaps a few other nice server > features, like SSI and name based virtual hosts. > > Any suggestions? I have not seriously used Windows for years now, so my > knowledge of that platform is not exactly up to date anymore. I am used > to dealing with Debian/Ubuntu Linux and Apache but not much else, > frankly. Apache does seem to heavy for this. My initial thought was to > install Lighttpd under Cygwin, but perhaps I would be missing out on some > great little server program that I have not yet heard about. I use lighttpd on Linux, but there seems to exist a Windows version as well: http://www.lighttpd.net/ I have written about using it with PHP here: http://www.phpclasses.org/blog/post/69-13-rules-to-optimize-your-Web-site-performance.html -- Regards, Manuel Lemos Find and post PHP jobs http://www.phpclasses.org/jobs/ PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php