CPC900 Posted November 23, 2011 Report Posted November 23, 2011 Ok, I have read the forum, but don't think the answer is there?! I get this error now, and not sure why or what I might have done to get it: Warning: imagepng() [function.imagepng]: Unable to open '/home/########/public_html/CPC//lib/signaturesCPC0001.png' for writing: Permission denied in /home/########/public_html/CPC/core/common/PilotData.class.php on line 1001 Now I noticed a double "//" above in the "/home/########/public_html/CPC//lib/signaturesCPC0001.png" part and was wondering if that is the problem? If it is, I have no idea why there are 2 slashes there?!? Line 1001 in my PilotData.class.php is: imagepng($img, SITE_ROOT . SIGNATURE_PATH . '/' . $pilotcode . '.png', 1); Quote
Moderators mark1million Posted November 23, 2011 Moderators Report Posted November 23, 2011 Make sure that folder the signatures has 777 permissions. Thanks the error, its unable to create the image. Quote
CPC900 Posted November 23, 2011 Author Report Posted November 23, 2011 Yeah, it is set to 777, thanks. But I was asking why there were double slash's in the address. I think therein lies the problem. I just don't know why that would have changed?! Quote
Jeff Posted November 23, 2011 Report Posted November 23, 2011 You could try to see if this is what is located in your PilotData.class.php to see if it is missing something. /** * This generates the forum signature of a pilot which * can be used wherever. It's dynamic, and adjusts it's * size, etc based on the background image. * * Each image is output into the /lib/signatures directory, * and is named by the pilot code+number (ie, VMA0001.png) * * This is called whenever a PIREP is accepted by an admin, * as not to burden a server with image generation * * Also requires GD to be installed on the server * * @param int The pilot ID for which to generate a signature for * @return bool Success */ public function generateSignature($pilotid) { $pilot = self::getPilotData($pilotid); $last_location = PIREPData::getLastReports($pilotid, 1, PIREP_ACCEPTED); $pilotcode = self::getPilotCode($pilot->code, $pilot->pilotid); if(Config::Get('TRANSFER_HOURS_IN_RANKS') === true) { $totalhours = $pilot->totalhours + $pilot->transferhours; } else { $totalhours = $pilot->totalhours; } # Configure what we want to show on each line $output = array(); $output[] = $pilotcode.' '. $pilot->firstname.' '.$pilot->lastname; $output[] = $pilot->rank.', '.$pilot->hub; $output[] = 'Total Flights: ' . $pilot->totalflights; $output[] = 'Total Hours: ' . $totalhours; $output[] = 'Current Location: ' . $last_location->arricao; if(Config::Get('SIGNATURE_SHOW_EARNINGS') == true) { $output[] = 'Total Earnings: ' . $pilot->totalpay; } # Load up our image # Get the background image the pilot selected if(empty($pilot->bgimage)) $bgimage = SITE_ROOT.'/lib/signatures/background/background.png'; else $bgimage = SITE_ROOT.'/lib/signatures/background/'.$pilot->bgimage; if(!file_exists($bgimage)) { # Doesn't exist so use the default $bgimage = SITE_ROOT.'/lib/signatures/background/background.png'; if(!file_exists($bgimage)) { return false; } } $img = @imagecreatefrompng($bgimage); if(!$img) { $img = imagecreatetruecolor(300, 50); } $height = imagesy($img); $width = imagesx($img); $txtcolor = str_replace('#', '', Config::Get('SIGNATURE_TEXT_COLOR')); $color = sscanf($txtcolor, '%2x%2x%2x'); $textcolor = imagecolorallocate($img, $color[0], $color[1], $color[2]); $font = 3; // Set the font-size $xoffset = Config::Get('SIGNATURE_X_OFFSET'); # How many pixels, from left, to start $yoffset = Config::Get('SIGNATURE_Y_OFFSET'); # How many pixels, from top, to start $font = Config::Get('SIGNATURE_FONT_PATH'); $font_size = Config::Get('SIGNATURE_FONT_SIZE'); if(function_exists('imageantialias')) { imageantialias($img, true); } /* Font stuff */ if(!function_exists('imagettftext')) { Config::Set('SIGNATURE_USE_CUSTOM_FONT', false); } # The line height of each item to fit nicely, dynamic if(Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { $stepsize = imagefontheight($font); $fontwidth = imagefontwidth($font); } else { // get the font width and step size $bb = imagettfbbox ( $font_size, 0, $font, 'A'); $stepsize = $bb[3] - $bb[5] + Config::Get('SIGNATURE_FONT_PADDING'); $fontwidth = $bb[2] - $bb[0]; } $currline = $yoffset; $total = count($output); for($i=0;$i<$total;$i++) { if(Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { imagestring($img, $font, $xoffset, $currline, $output[$i], $textcolor); } else { // Use TTF $tmp = imagettftext($img, $font_size, 0, $xoffset, $currline, $textcolor, $font, $output[$i]); // Flag is placed at the end of of the first line, so have that bounding box there if($i==0) { $flag_bb = $tmp; } } $currline+=$stepsize; } # Add the country flag, line it up with the first line, which is the # pilot code/name $country = strtolower($pilot->location); if(file_exists(SITE_ROOT.'/lib/images/countries/'.$country.'.png')) { $flagimg = imagecreatefrompng(SITE_ROOT.'/lib/images/countries/'.$country.'.png'); if(Config::Get('SIGNATURE_USE_CUSTOM_FONT') == false) { $ret = imagecopy($img, $flagimg, strlen($output[0])*$fontwidth, ($yoffset+($stepsize/2)-5.5), 0, 0, 16, 11); } else { # figure out where it would go $ret = imagecopy($img, $flagimg, $flag_bb[4]+5, $flag_bb[5]+2, 0, 0, 16, 11); } } # Add the Rank image if(Config::Get('SIGNATURE_SHOW_RANK_IMAGE') == true && $pilot->rankimage!='' && file_exists($pilot->rankimage)) { $ext = substr($pilot->rankimage, strlen($pilot->rankimage)-3, 3); # Get the rank image type, just jpg, gif or png if($ext == 'png') $rankimg = @imagecreatefrompng($pilot->rankimage); elseif($ext == 'gif') $rankimg = @imagecreatefromgif($pilot->rankimage); else $rankimg = @imagecreatefromjpg($pilot->rankimage); if(!$rankimg) { echo '';} else { $r_width = imagesx($rankimg); $r_height = imagesy($rankimg); imagecopy($img, $rankimg, $width-$r_width-$xoffset, $yoffset, 0, 0, $r_width, $r_height); } } if(Config::Get('SIGNATURE_SHOW_COPYRIGHT') == true) { # # DO NOT remove this, as per the phpVMS license $font = 1; $text = 'powered by phpvms, '. SITE_NAME.' '; imagestring($img, $font, $width-(strlen($text)*imagefontwidth($font)), $height-imagefontheight($font), $text, $textcolor); } imagepng($img, SITE_ROOT.SIGNATURE_PATH.'/'.$pilotcode.'.png', 1); imagedestroy($img); } } It may also be in the way the path is written. You can see if the signature is supposed to be written after the CPC/ or the CPC. If it is after the CPC/ then you might want to remove the / or just route it to the full URL. Quote
CPC900 Posted November 24, 2011 Author Report Posted November 24, 2011 I will review the code when I get home later. As for the "/", I did remove that just to see, but no luck. I will copy and paste your code here to see. But I was wondering if I would have changed the PilotData.class.php code for some reason?! I sure don't remember why, if I did. Thanks, will keep u posted. Quote
Administrators simpilot Posted November 24, 2011 Administrators Report Posted November 24, 2011 It is a directory issue, I ran into the same thing. For my fix I just has to use the complete absolute url in the ranks image setting. http://www.yoursite.com/path to image not /path to image 1 Quote
Administrators Nabeel Posted November 24, 2011 Administrators Report Posted November 24, 2011 The double slashs doesn't matter Quote
CPC900 Posted November 25, 2011 Author Report Posted November 25, 2011 Ok, I will look into it. I have had NO time to fix it since I last posted. Thanks for the input Dave, I will take a look! It's weird though, why would it have changed?! Oh well. Probably something I did Quote
CPC900 Posted November 28, 2011 Author Report Posted November 28, 2011 Thanks Dave, that fixed it Bruce Quote
CPC900 Posted November 28, 2011 Author Report Posted November 28, 2011 Correction. It did not fix it. I don't get the error pop up, but it does NOT change the signature with updated hours, nor will it change the sig pic from the pilot profile. So something, somewhere, I must have broken Quote
Administrators Nabeel Posted November 28, 2011 Administrators Report Posted November 28, 2011 Make sure permissions are ok, sometimes they change b/c of server side stuff Quote
CPC900 Posted November 28, 2011 Author Report Posted November 28, 2011 I can't remember now, is there a list for PHPVMS of what folder and file permissions, SHOULD be set to?! Sorry, if that seems like an obvious question, but I am at a loss right now Quote
Administrators Nabeel Posted November 28, 2011 Administrators Report Posted November 28, 2011 775 or 777, I'd ask your host what they recommend, it depends how they've setup file/folder ownership. Quote
CPC900 Posted May 3, 2012 Author Report Posted May 3, 2012 Dave, sorry to come back to this after so long, but I never did get it fixed As for what you said above, where EXACTLY did you mean, when you said: It is a directory issue, I ran into the same thing. For my fix I just has to use the complete absolute url in the ranks image setting. http://www.yoursite.com/path to image not /path to image Quote
CPC900 Posted May 8, 2012 Author Report Posted May 8, 2012 Sorry Dave, but I need to know exactly where the code goes, and what the correct line of code actually is Quote
Administrators simpilot Posted May 8, 2012 Administrators Report Posted May 8, 2012 It has been a while but I think this falls back to the pilot rank images and not using relative paths in the admin center. In the pilot ranks admin panel instead of /lib/images/ranks/newhire.png Use http://www.mysite.com/lib/images/ranks/newhire.png Quote
CPC900 Posted May 9, 2012 Author Report Posted May 9, 2012 Ok, I finally fixed it, after reading over and over again what you all told me Sorry, but sometimes, I am a total MORON apparently. It is good now. The folder permissions were fine, but I made the .png files all 777 in the signatures folder and all is fine. The individual .png files were 644 or something. Not sure why that was. Quote
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.