paymentstv Posted December 14, 2010 Share Posted December 14, 2010 Hello All, I have tried to find a solution for this issue for days. The script was working fine until yesterday when all of a sudden I get this warning. Warning: imagecreatefrompng(http://domain.com/images/broadcast1.png) [function.imagecreatefrompng]: failed to open stream: Connection timed out in /home/domain/public_html/logo/logo1.php on line 8 line 8 is: $image_1 = imagecreatefrompng($file_1); Where $file_1 = "http://domain.com/images/broadcast1.png"; The exact code is working perfectly fine in a different server I have, both servers are running Centos with PHP5 + GD fully enabled. The image http://domain.com/images/broadcast1.png (~5Kb) is loading very fast when open through a browser. Please please help me resolve this, I have tried many different things and even uninstall and install GD again but n luck. Thank you so much for your help. Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 14, 2010 Share Posted December 14, 2010 Oh you might wanna set: set_time_limit(60); So it doesn't time out... And you may also wanna try: $filecontent=file_get_contents('http://www.phpfreaks.com'); for example from phpfreaks, to see if it can load stuff from other sites... try to load other images that is located on a network. It would also be nice if you gave us the exact image url. Quote Link to comment Share on other sites More sharing options...
paymentstv Posted December 14, 2010 Author Share Posted December 14, 2010 Oh you might wanna set: set_time_limit(60); So it doesn't time out... And you may also wanna try: $filecontent=file_get_contents('http://www.phpfreaks.com'); for example from phpfreaks, to see if it can load stuff from other sites... try to load other images that is located on a network. It would also be nice if you gave us the exact image url. 1. The timeout occurs at about 90Seconds now but since it is a very active site that is not a solution 2. I have tried another image http://www.drweb.de/icons/twitter/pd_twitter_iconset/pd_twitter_iconset/PNG/256/icon_c.png now I get a different error Warning: imagecreatefromjpeg(http://domain.com/logo/logo.php?txt=By:cnn.com) [function.imagecreatefromjpeg]: failed to open stream: Connection timed out in /home/domain/public_html/logo/logo1.php on line 15 Where line 15 is $image_2 = imagecreatefromjpeg($file_2); Where; $image_2= "http://domain.com/logo/logo.php?txt=By:$name"; //This logo.php converts the string By:$name to a jpeg file. logo.pho is working as I can see the image when I try this in a browser. 3.I am sorry because I am not authorized to put the whole code or site name in public forums. Please accept my apologies. Since the code worked 100% until tomorrow morning I believe it has to do with php installation/ WHM/Cpanel/ GD..etc but I need help to figure out where I should look. Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 14, 2010 Share Posted December 14, 2010 When I tried to see that picture: Forbidden You don't have permission to access /icons/twitter/pd_twitter_iconset/pd_twitter_iconset/PNG/256/icon_c.png on this server. Additionally, a 302 Found error was encountered while trying to use an ErrorDocument to handle the request. Apache/2.2.3 (Debian) PHP/5.2.8-0.dotdeb.1 with Suhosin-Patch mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.drweb.de Port 80 Besides: $image_2= "http://domain.com/logo/logo.php?txt=By:$name"; $image_2 = imagecreatefromjpeg($file_2); $image_2!=$file_2 May be you did a typo here now though, and it might be the installation of something around GD... Quote Link to comment Share on other sites More sharing options...
paymentstv Posted December 14, 2010 Author Share Posted December 14, 2010 I was able to see the image fine but I will use another png file hosted in a spare server. http://173.244.194.170:805/item.png When I use that image in; $file_1 = "http://173.244.194.170:805/item.png"; $image_1 = imagecreatefrompng($file_1); I get the original error back. Warning: imagecreatefrompng(http://173.244.194.170:805/item.png) [function.imagecreatefrompng]: failed to open stream: Connection timed out in /home/veedo/public_html/logo/logo1.php on line 8 I have a feeling this might have something to do with URL open ability of php? Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 14, 2010 Share Posted December 14, 2010 Yeah, I was about to suggest you try to open a local image too... and it would be nice if you tried this too: $filecontent=file_get_contents('http://www.phpfreaks.com'); echo $filecontent; Quote Link to comment Share on other sites More sharing options...
paymentstv Posted December 14, 2010 Author Share Posted December 14, 2010 tried this code <p>PHP version is: <?php echo phpversion(); ?></p> <p>Safe mode is: <?php echo ($bSafeMode) ? "On (this is usually bad)" : "Off (this is good!)"; ?></p> <?php /* * Try opening www.microsoft.com */ @$fIn = fopen("http://www.domain.com/logo/logo.php?txt=By:cn.com","r"); if ($fIn !== FALSE) { echo "<p>URL open succeeded!</p>"; fclose($fIn); } else{ echo "<p>URL open failed: $php_errormsg</p>";} $filecontent=file_get_contents('http://www.phpfreaks.com'); echo $filecontent; ?> Result: PHP version is: 5.2.14 Safe mode is: Off (this is good!) URL open succeeded! Subscribe to PHP Freaks RSS And after that I see contents of phpfreaks site. Quote Link to comment Share on other sites More sharing options...
MMDE Posted December 14, 2010 Share Posted December 14, 2010 But you didn't try to use a local png file... imagecreatefromjpeg('picture.png'); Quote Link to comment Share on other sites More sharing options...
paymentstv Posted December 14, 2010 Author Share Posted December 14, 2010 When I try the local file it display the image correctly. However, second part of the image is not created $imageurl = "http://domain.com/logo/logo.php?txt=By:"; $file_2 = $imageurl.$sitename;//$sitename is a variable passed on to this logo1.php $image_2 = imagecreatefromjpeg($file_2); I create two images image_1 and image_2 and then use php to copy them to a single image. In this case only the first image (local png file) is displayed. No errors reported. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.