我读过这篇文章:Does TideSDK have any image manipulation capabilities?
我尝试过使用gd函数,但在我的TideSDK应用程序中失败了,然后运行get_extension_funcs("gd");来找出哪些gd函数可用,并且我得到了一个'null‘响应。我还检查了一下加载了什么ini文件(也返回了null )。看来php模块运行得很薄(可以理解)。以下是我尝试过的事情:
我的经验是编写php应用程序代码,而不是环境配置。你有什么想法吗?您能够成功地在TideSDK中使用gd库吗?
我正在探索用TideKit预订座位的可能性,但我正在做一个探索性的构建,以确保它完成了我首先需要的所有工作。谢谢你的帮助!
发布于 2014-07-11 20:28:48
标识一个可移植的CLI (命令行)映像库,在我的例子中,这是ImageMagick。我能够通过Ruby通过Bash实现这个功能。一个“可移植的”映像库是这样一个: a.可以在服务器上不安装就可以运行--也就是说,不需要名称路径就能正常工作--只要你知道它在哪里,你就可以cd到那个目录,然后让它工作。它不能太大,否则它将导致您的应用程序的大量下载。
样本代码:
### 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}"https://stackoverflow.com/questions/24631567
复制相似问题