The class which contains the method is as follows:

包含该方法的类如下:

<?php
   class renderText {
      function text_to_image( $text, $width, $height, $image_file ) {
         $fonts_dir = 'path/to/directory/in/which/SreeKrushnadevaraya.ttf/is/located/';
         $ret = mb_language('uni');
         mb_internal_encoding('UTF-8');
         header('Content-type: image/gif');
         $font = $fonts_dir.'SreeKrushnadevaraya.ttf';
         error_log("=before imagecrttrucolour",3,'path/to/frontend_dev.log');
         $im = imagecreatetruecolor( $width, $height );
         error_log("=after imagecrttrucolour",3,'path/to/frontend_dev.log');
         $white = imagecolorallocate( $im, 255, 255, 255 );
         $black = imagecolorallocate( $im, 0, 0, 0 );
         imagefilledrectangle( $im, 0, 0, $width, $height, $white );
         imagettftext( $im, 10, 0,10 ,30, $black, $font, $text );
         $image_file = '/tmp/'.date('YmdHis').$width.$height.'.gif';
         imagegif( $im, $image_file );
         imagedestroy( $im );
         return $image_file;
      }
   }
?>

The following code is added in symfony as well as the local script. It works fine in the local script but fails in symfony:

symfony中添加了以下代码以及本地脚本。它在本地脚本中工作正常但在symfony中失败:

// Set the enviroment variable for GD
putenv('GDFONTPATH=' . realpath('path/to/directory/in/which/SreeKrushnadevaraya.ttf/is/located/'));

// Name the font to be used (note the lack of the .ttf extension)
$font = 'SreeKrushnadevaraya';

The method is called thus:

因此调用该方法:

$image_file = '/tmp/'.date('YmdHis').'260'.'x'.'32.gif';
 $rendered_text = renderText::text_to_image($this->getRequestParameter('caption_unicode'), 240, 32, $image_file);

php Version : PHP 5.3.6

PHP版本:PHP 5.3.6

symfony version 1.0.22

symfony版本1.0.22

1 个解决方案

#1


0

You probably have two versions of PHP installed:

您可能安装了两个版本的PHP:

  • the Apache extension used when running it via Symfony
  • 通过Symfony运行它时使用的Apache扩展

  • and the PHP cli used when you run scripts
  • 以及运行脚本时使用的PHP cli

And each version has it's own php.ini configuration file. You probably haven't loaded the extension or misconfigured it in the Apache configuration file.

每个版本都有自己的php.ini配置文件。您可能没有加载扩展或在Apache配置文件中错误配置它。

You can find out the location of the Apache php.ini configuration file when executing phpinfo(). (In the Symfony toolbar for example)

执行phpinfo()时,您可以找到Apache php.ini配置文件的位置。 (例如在Symfony工具栏中)

更多相关文章

  1. php-fpm通过request_slowlog_timeout检查哪个脚本执行时间长
  2. 在php中检测浏览器,版本和平台的可靠方法
  3. 显示长期运行的PHP脚本的进展。
  4. centos7 升级php版本
  5. 在rhel5版本下安装mysql+apache+php实战攻略
  6. mac下安装多版本PHP及切换
  7. PHP基础之脚本传参
  8. phpBB3导入帖子的Python脚本
  9. PHP脚本在我的Wordpress文件中。请解码或帮助我删除它。

随机推荐

  1. linux下使用共享存储编程初试 (转载)
  2. 【Linxu内核设计与实现】-第7章 中断和中
  3. Linux下Rsync+Inotify-tools实现数据实时
  4. linux系统编程之进程(八):守护进程详解及创
  5. 利用ssh-copy-id复制公钥到多台服务器
  6. 获取网卡名称 linux c
  7. Emacs 快速参考 c-c++ 模式
  8. Linux零散知识点笔记
  9. socket的长连接、短连接、半包、粘包与分
  10. 如何更改提示颜色?