zamight Posted January 18, 2014 Share Posted January 18, 2014 After switching to a vps my file will not write to the img anymore. GD Support enabled GD Version 2.0 FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.4.9 GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version unknown PNG Support enabled libPNG Version 1.2.49 WBMP Support enabled the php code. It does make the img but doesn't write the number. It did work previously on other server. <?php $imageURL = $_GET['imageURL']; if($imageURL == "money"){ $im = imagecreatefrompng("images/gp.png"); }else { $imageURL = str_replace(" ", "%20", $imageURL); $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $imageURL); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); $im = imagecreatefromstring($data); } $quantity = $_GET['quantity']; if($quantity > 1 OR isset($_GET['displayNum'])){ //Fixed the amount display, was a bug I found if the quantity was 10m+ if($quantity < 100000){ $color = imagecolorallocate($im, 255, 255, 0); $suffix = ''; }else if($quantity < 10000000){ $color = imagecolorallocate($im, 255, 255, 255); $quantity = floor($quantity / 1000); $suffix = 'K'; }else { $color = imagecolorallocate($im, 0, 255, 0); $quantity = floor($quantity / 1000000); $suffix = 'M'; } imagettftext($im, 8, 0, 8, 13, $color, 'arial.ttf', number_format($quantity) . $suffix); } header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> Thanks if you guys can help! Quote Link to comment https://forums.phpfreaks.com/topic/285464-imagettftext-wont-write/ Share on other sites More sharing options...
zamight Posted January 18, 2014 Author Share Posted January 18, 2014 solved. Quote Link to comment https://forums.phpfreaks.com/topic/285464-imagettftext-wont-write/#findComment-1465642 Share on other sites More sharing options...
Barand Posted January 18, 2014 Share Posted January 18, 2014 Thank you for sharing the solution for others having a similar problem. How many times have you googled a problem only to find the same question many times but no actual solution? Quote Link to comment https://forums.phpfreaks.com/topic/285464-imagettftext-wont-write/#findComment-1465663 Share on other sites More sharing options...
requinix Posted January 18, 2014 Share Posted January 18, 2014 Thank you for sharing the solution for others having a similar problem. How many times have you googled a problem only to find the same question many times but no actual solution? Having spent years trying to get others to understand that very idea, I've found a fairly simple way of convincing people to post solutions: what you do is Quote Link to comment https://forums.phpfreaks.com/topic/285464-imagettftext-wont-write/#findComment-1465664 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.