首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >显然,GD没有与TideSDK php模块捆绑在一起

显然,GD没有与TideSDK php模块捆绑在一起
EN

Stack Overflow用户
提问于 2014-07-08 12:11:52
回答 1查看 71关注 0票数 2

我读过这篇文章:Does TideSDK have any image manipulation capabilities?

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

  1. 使用python的PIL库(与python有类似的库问题)
  2. 使用ruby (这里最成功,但一直遇到问题,找出是否加载了chunky_png,并且每次红宝石'embedded server‘被卷起时都要加载它
  3. 设置一个“本地”php.ini文件,尝试将gd库插入(超出我在这里的深度)

我的经验是编写php应用程序代码,而不是环境配置。你有什么想法吗?您能够成功地在TideSDK中使用gd库吗?

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

EN

回答 1

Stack Overflow用户

发布于 2014-07-11 20:28:48

标识一个可移植的CLI (命令行)映像库,在我的例子中,这是ImageMagick。我能够通过Ruby通过Bash实现这个功能。一个“可移植的”映像库是这样一个: a.可以在服务器上不安装就可以运行--也就是说,不需要名称路径就能正常工作--只要你知道它在哪里,你就可以cd到那个目录,然后让它工作。它不能太大,否则它将导致您的应用程序的大量下载。

样本代码:

代码语言:javascript
复制
### 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脚本:

代码语言:javascript
复制
#!/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}"
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24631567

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档