GD显然没有捆绑在TideSDK php模块



我读了这个帖子:TideSDK有任何图像处理功能吗?

我已经尝试使用gd函数,并在我的TideSDK应用程序中失败,然后我运行get_extension_funcs("gd");以找出哪些gd函数可用,并且我得到一个'null'响应。我还检查了加载的ini文件(也返回null)。看起来php模块运行得很瘦(可以理解)。以下是我尝试过的方法:

  1. 使用python的PIL库(在python中有类似的库问题)
  2. 使用Ruby的chunky_png gem(在这里最成功,但一直遇到问题,弄清楚gem是否被加载,并且每次Ruby'嵌入式服务器'都要加载它
  3. 设置一个'本地' php.ini文件,试图将gd库推入(超出我的深度)

我的经验主要是编写php应用程序代码,而不是环境配置。你有什么主意吗?您是否能够成功地将gd库与TideSDK一起使用?

我正在探索用TideKit预订座位的可能性,但我正在做一个探索性的构建,以确保它首先做了我需要的一切。谢谢你的帮助!

确定一个可移植的CLI(命令行)图像库,在我的例子中,这是ImageMagick。我能够通过Ruby和Bash让它工作。一个"可移植"的图像库应该是:a.可以运行而不需要安装在服务器上,即不需要名称路径正常工作-所以只要你知道"在哪里",你可以cd到那个目录,并让它工作b.具有可接受的足迹。它不能太大,否则将导致应用程序的大量下载。

示例代码:

### Bash installer for portable build of ImageMagick
#!/bin/bash
# change to scripts directory in Snicket application Contents path
echo "Installing ImageMagick…"
_APPDIR=$1
# _SCRIPTDIR=${1:-.}
_SCRIPTDIR="${_APPDIR}/Resources/scripts"
_HOME=${2:-${HOME}}
echo "Home -> ${_HOME}"
# Figure out directory absolute path
_TODIR=$_HOME/SnicketTools
mkdir $_TODIR
# remove previous installation
_MAGICK_DIR=$_TODIR/ImageMagick-6.8.9
echo "Removing existing directory -> ${_MAGICK_DIR}"
rm -r $_MAGICK_DIR
cd $_TODIR
tar xzvf "${_APPDIR}/Resources/tools/ImageMagick-x86_64-apple-darwin13.2.0.tar.gz"
#if [[ "$3" ]]; then
#   #statements
#   cp -r ./ImageMagick-6.8.9 $3/
#fi
# delete temporary copy of magic directory
## echo "Deleting temporary files from ${PWD}/ImageMagick-6.8.9 -> "
# rm -r ./ImageMagick-6.8.9
# open $_TODIR
echo "Magic directory (before export): ${_MAGICK_DIR}"
export MAGICK_HOME=$_MAGICK_DIR
echo "Magic directory: ${_MAGICK_DIR}"
echo "Magic home: ${MAGICK_HOME}"
## Clean profile file 
_PROFILE=`cat ~/.bash_profile`
echo "Profile information -> ${_PROFILE}"
## You need to add export statements to ~/.bash_profile or ~/.profile 
## or /etc/profile file. This will export variables permanently:
echo "# Snicket Magick Config" >> ~/.bash_profile
echo "export MAGICK_HOME=${_MAGICK_DIR}" >> ~/.bash_profile
echo "export PATH=$PATH:${MAGICK_HOME}/bin" >> ~/.bash_profile
echo "export DYLD_LIBRARY_PATH=${MAGICK_HOME}/lib/" >> ~/.bash_profile
echo "# End Snicket Magick Config" >> ~/.bash_profile
# Reload bash parameters
source ~/.bash_profile
## >> appends to an existing file
# source ~/.bash_profile
# check bash profile # open ~/.bash_profile
接下来,Bash脚本运行基本的图像转换使用库:

#!/bin/bash
## You MUST change to the magick directory before running in portable mode
# Use from within Ruby
# cmd = "bash #{$BASHDIR}/make_thumbnail.sh "#{$MAGICK_HOME}#{$DS}bin" "#{img}" "#{tfile}""
# cmd = "#{MAGICK_HOME}#{DS}bin#{DS}compress "#{img}" -resize 240x240\> "#{tfile}""
_MAGICK_DIR=$1
_SRC=$2
_THUMB=$3
echo "Changing directory to -> ${_MAGICK_DIR}"
cd $_MAGICK_DIR
echo "Converting from ${_SRC} to ${_THUMB}"
source ~/.bash_profile
./convert "${_SRC}" -resize 240x240> "${_THUMB}"

最新更新