lvmllc
asked on
SimpleImage PHP stopped working on Windows 2008 r2
I have been using simple fine for the last few years and have found that in some point in the last 3 months it stopped working for me.
doing a test with the following code produces no image on the screen - instead I get the text below the code. I am using the same practice image I usually use (as well as others) and get similar gibberish. I have tried this with both PHP 5.2.17 and 5.4.14 - same result.
The screen output:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!2222222222222222222222222 2222222222 2222222222 22222ÿÀp –" ÿÄ ÿĵ}!1 AQa"q2 ‘¡#B±ÁR Ñð$3br‚ %&'()*456789:CDEFGHIJ STUVWXYZcd efghijstuv wxyzƒ„…†‡ˆ ‰Š’“”•–—˜™ š¢£¤¥¦§¨©ª ²³´µ¶·¸¹ºÂ ÃÄÅÆÇÈÉÊÒÓ ÔÕÖ×ØÙÚáâã äåæçèéêñòó ôõö÷øùúÿÄ ÿĵw!1 AQaq"2 B‘¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFG HIJSTUVWXY Zcdefghijs tuvwxyz‚ƒ„ …†‡ˆ‰Š’“”• –—˜™š¢£¤¥¦ §¨©ª²³´µ¶· ¸¹ºÂÃÄÅÆÇÈ ÉÊÒÓÔÕÖ×ØÙ Úâãäåæçèéê òóôõö÷øùúÿ Ú?öÅBqŽ+@XÈG8¦ÿf¿¨¬ “(Ï|ªr¦sŠ Øk Gj«%³÷y¦˜XÈhð2jŒu'‰•W Oɪ×IåÆI¨ SBú2ÊJ •»;œÕm€ö ‹s¸“Pù Ñ2JÂ:vÜ œÇƒÅ”\ ø£¥ÛÏ”\JÓ«3M)H Ä*fZ(ô¥¤¥¨(J¥v˜É7P»’Êk gHÚU‘¼¶G' =úU¹“|dVr ×äRV0˜rx¨Ú <öâ«kÚ’èói Ï*±†âè[»/D ܧ}·`~5¨bÈæ¦ãhÏh¸éU%v«r]F/ž Ïpˆ„ zŒü꼧É5IŠÅ eߟJ¡u déZR õZ[`èpqøÓ¸¬só6rqUðkBhâó ªlWj™vl КGÍJ#\ b”§µL@©Œi\Jâ£j‘‰¨Xšk )“ÞŠ`}EyÏþ(éÚ‘ky¢ßéúŒí 0ßs«Lç#œ~UÆ¿í}%”¾^ƒSýÛ›‚À]»yIv=¿íiS"y¾P&FìdŒãÒ§a¹ H¯Œ5µ×Æ» ý¡)ÔCîóIý1 Ó±Óô/ƒ>(è¾$Ó¯®ôýB5tSÈ[ý¤'¨>GëI« ±½©iñÜÜZÅ2,¨d'k.F@Èý@«rDUq Žj¥Æ½£É{dc Õ,œol•¸Cü' Þ§]_N¼2{ëiLm±öJ§ë\ÒÐÑ;˜ÓYyšÙ¹ c€&}U˜’?5ð¢xÖ(ÚI]R5fc€© 5Áx¯â£øgÅ× ºöds¢,jÍÆF7gÿý+Í|_ãýWÄò4RL!µ‹xN}¼}Ïá ŠÒ1“hôÛ/ˆ Ú5ÿ‰äÑám±Ÿ –¦?,Ü{{õÓ¼R¼{ùk89w¯^ðgÄ¥“K{-eØÜÛD Z9{̪3Žˆ ÏëÖÜm±)÷;¹ ¡U®+*á 'SGñžâ9åŠÍ.£MìdP\v&¡Ôµ pÇSL/ô¤; “’Y8ä.rj6“ jf•XmÆjùŽ = +ŽQ¶¤Î¥1¹Î}©œS Ý·=†)Ì2>ðô¦IR©ÿëÔŒ¬sQ•ö5{Ëù䟟ÿ^ž¶›°[Ê Ð“@eO]´¢ Êî>ß]¦¶E šÈ彑OøÔR$â+i>¬ôÄe³¸Éüª2} «PÙ«òaûùN [.ÞKÿ]øR )»«€GË×Þ ¸tÇë[?Ùð¹ S°~g'ù š+£bH³þÆ{ŸZd˜‹3{P«æ66’qÚ º1¤`PþTðBð þ&€9ãjäpŸ¥GöYÁ Âÿ÷É®¤n£,þÿ€ ²Ïÿ<%ÿ¾M'Ù®?ç„Ÿ÷Á®ƒkÉ54q BÃæçÐœP5 ök‘Ö'QŠr¤ áúçÔUûû;攘·y}‚¶k1íî²ÐÈ© ï@8ÂÁù< Š)ZK"âKyGN1EYþÐ}èã?QDwÈ >Wˆu' úóU÷))ÏáL xÜ2+ŒÑ[«W dúð©Ä Ìn¬=ŽkÈaÅ"³#¤©Çj.#XÛ‘ë@…‡z¯g¨7œ#³»€Ät5§ ¾2ÛIÃzb‹ŽÅ SúÓqÞ¯yA º>? kÛžäQp±DîîM&O÷\6çÅFT/ÄA ½‡ñ_5ýXÒ· µ0³ “ÍzQ3Tš““@üöõ£íÞ#òOšCÅZicläsìqP¢l¤Óo4â ¢É 6(ð˜÷–Oû¼Ñ@O*Iæ7\þ 5´aŽß,è BúP•òŸ»öÆj FdïÏJ7±ÿÙ ÆLÄØOþ½=t%8-+ƒô˜Œ<œsŠÖ ½ŒW’\pÙç?äÕ•Ñ-×ï<‡ñáK䥽£ªýÝØúÐŽPnVϸ欉NÞâ«A'ɃŽ:bž\R!} Ãj7By‘OYžÇð¦VVô¨Êš¶ã<’ @Ûêiˆ®ÀÓp jbÊ;SÐ ‹Þ“žâ¥Þ=)…ý¨0Ojµ!v¤ÞÞ´ &ÓEG¹z(ÿ Ù
doing a test with the following code produces no image on the screen - instead I get the text below the code. I am using the same practice image I usually use (as well as others) and get similar gibberish. I have tried this with both PHP 5.2.17 and 5.4.14 - same result.
<?php
error_reporting(E_ALL);
if( isset($_POST['submit']) ) {
include('SimpleImage.php');
$image = new SimpleImage();
$image->load($_FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth(150); $image->output();
} else {
?>
The form:<br>
<form action="uploaderTest.php" method="post" enctype="multipart/form-data">
<input type="file" name="uploaded_image" />
<input type="submit" name="submit" value="Upload" />
</form>
<?php
}
?>
The screen output:
ÿØÿàJFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v80), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!2222222222222222222222222
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The code should Always have had the 'header' line, that's been a requirement for about 20 years. Adding that alone should have caused the output to be sent as an image even if it isn't the right one.
Dave, the headers are set within the simpleimage class
Gary, not according to the SimpleImage doc page I posted that matches the rest of his code. http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/ Note that there is more than one application named SimpleImage.
mmmm I was looking at this one
https://gist.github.com/miguelxt/908143
https://gist.github.com/miguelxt/908143
ASKER
I have confirmed that the file is being written to the windows/temp dir.
Interesting, but the path was not listed in the .ini setting viewer. so went to the .ini itself and entered a different path and it said I had an error so I told it to default back. Now it does show up in the setting viewer.
So with that solved I tried it again and checked the dir where SimpleImage should place the thumbnail and the uploaded image. That dir somehow defaulted to read only. I set it to read write and it works again. So my question now is there a way I can make it so only the script can writ to the folder and not anyone who goes to that URL?
Also, I noticed that when I added the header stuff that I mistakenly also added
$image->load('picture.jpg' );
so changed it back to
$image->load($_FILES['uplo aded_image ']['tmp_na me']);
Interesting, but the path was not listed in the .ini setting viewer. so went to the .ini itself and entered a different path and it said I had an error so I told it to default back. Now it does show up in the setting viewer.
So with that solved I tried it again and checked the dir where SimpleImage should place the thumbnail and the uploaded image. That dir somehow defaulted to read only. I set it to read write and it works again. So my question now is there a way I can make it so only the script can writ to the folder and not anyone who goes to that URL?
Also, I noticed that when I added the header stuff that I mistakenly also added
$image->load('picture.jpg'
so changed it back to
$image->load($_FILES['uplo
No, it would need to run under the IUSR account, you cannot restrict access by file
Gary, the version in your link says it's a modified version and it does include the 'header' lines. And the version in my link which appears to be the 'original' does not have the 'header' lines. Wonder which version the asker is using?
ASKER
The date on it was 8/11/2006 - so I know it is old.
I do know there are alternative versions. Which are you looking at?
I do know there are alternative versions. Which are you looking at?
My link http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/ appears to be the original plus one update. Gary's link https://gist.github.com/miguelxt/908143 is a newer version.
ASKER
[14-[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: getimagesize(picture.jpg):
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagesx() expects parameter 1 to be resource, null given in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: Division by zero in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagesy() expects parameter 1 to be resource, null given in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagecreatetruecolor(): Invalid image dimensions in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagesx() expects parameter 1 to be resource, null given in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagesy() expects parameter 1 to be resource, null given in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in C:\webSites\phpTest\Simple
[14-Oct-2013 12:26:07 America/Chicago] PHP Warning: imagejpeg() expects parameter 1 to be resource, boolean given in C:\webSites\phpTest\Simple
Open in new window