TinyMCE图像管理器插件;Archiv";
我正在使用TinyMCE图像管理器插件 我按照建议进行了配置 在config.base.php中,如果设置TinyMCE图像管理器插件;Archiv";,tinymce,Tinymce,我正在使用TinyMCE图像管理器插件 我按照建议进行了配置 在config.base.php中,如果设置 'upload_path' => '/var/www/example/template/', 'upload_uri' => 'http://www.example.com/template/', 它工作正常,但如果我使用: 'upload_path' => $upload_path, 'upload_uri' => $
'upload_path' => '/var/www/example/template/',
'upload_uri' => 'http://www.example.com/template/',
它工作正常,但如果我使用:
'upload_path' => $upload_path,
'upload_uri' => $upload_uri,
在哪里
$dir = $client->agencycode; //which is string
$upload_path = "/var/www/example/template/$dir/";
$upload_uri = "http://www.example.com/template/$dir/";
除了上传文件外,插件工作正常。
我可以创建目录,列出目录,删除文件。唯一不起作用的就是上传一个文件
为了使上传工作正常,是否需要进行任何配置
谢谢。最后,我改用了“图像”插件。
如前所述,此插件没有文档。如果您在上载透明png文件时遇到黑色背景问题,请将
Archiv->php->connector
中的函数create_png(…)
更改为以下代码:
function create_png($file, $width, $height, $pic_new_width, $pic_new_height, $thumb_width, $thumb_height){
#fetch the extention from the file
$file_path = substr($file,0,strrpos($file,DIRECTORY_SEPARATOR));
$file_name = substr($file,strlen($file_path)+1, (strrpos($file,".")-(strlen($file_path)+1)));
$file_ext = substr($file,strrpos($file,"."));
#create the picture
$pic = imagecreatetruecolor($pic_new_width, $pic_new_height);
$source = imagecreatefrompng($file);
// enable alpha blending on the destination image.
imagealphablending($pic, true);
// Allocate a transparent color and fill the new image with it.
// Without this the image will have a black background instead of being transparent.
$transparent = imagecolorallocatealpha( $pic, 0, 0, 0, 127 );
imagefill( $pic, 0, 0, $transparent );
$imgcpyrsmpld = imagecopyresampled( $pic, $source, 0, 0, 0, 0, $pic_new_width, $pic_new_height, $width, $height );
imagealphablending($pic, false);
// save the alpha
imagesavealpha($pic,true);
header('Content-type: image/png');
if(version_compare(PHP_VERSION, '5.1.2', '<')){
$imagepng = imagepng($pic, $file_path.DIRECTORY_SEPARATOR.$file_name.$file_ext);
}
else{
$imagepng = imagepng($pic, $file_path.DIRECTORY_SEPARATOR.$file_name.$file_ext, 0);
}
$imagedestroy = imagedestroy($pic);
list($width, $height) = @getimagesize($file);
#create the thumb
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
$source2 = imagecreatefrompng( $file );
// enable alpha blending on the destination image.
imagealphablending($thumb, true);
// Allocate a transparent color and fill the new image with it.
// Without this the image will have a black background instead of being transparent.
$transparent = imagecolorallocatealpha( $thumb, 0, 0, 0, 127 );
imagefill( $thumb, 0, 0, $transparent );
$imgcpyrsmpld2 = imagecopyresampled( $thumb, $source2, 0, 0, 0, 0, $thumb_width, $thumb_height, $width, $height );
imagealphablending($thumb, false);
// save the alpha
imagesavealpha($thumb,true);
header('Content-type: image/png');
if(version_compare(PHP_VERSION, '5.1.2', '<')){
$imagepng2 = imagepng($thumb, $file_path.DIRECTORY_SEPARATOR.$file_name.'_thumb'.$file_ext);
}
else{
$imagepng2 = imagepng($thumb, $file_path.DIRECTORY_SEPARATOR.$file_name.'_thumb'.$file_ext, 0);
}
$imagedestroy2 = imagedestroy($thumb);
}
函数create_png($file,$width,$height,$pic_new_width,$pic_new_height,$thumb_width,$thumb_height){
#从文件中获取扩展名
$file_path=substr($file,0,strrpos($file,DIRECTORY_SEPARATOR));
$file_name=substr($file,strlen($file_path)+1,(strrpos($file,“.”)(strlen($file_path)+1));
$file\u ext=substr($file,strrpos($file,“.”);
#创建图片
$pic=ImageCreateTureColor($pic\u新的\u宽度,$pic\u新的\u高度);
$source=imagecreatefrompng($file);
//在目标图像上启用alpha混合。
imagealphablending($pic,true);
//分配一个透明颜色并用它填充新图像。
//如果没有这一点,图像将具有黑色背景,而不是透明的。
$transparent=imagecolorallocatealpha($pic,0,0,0127);
imagefill($pic,0,0,$transparent);
$imgcpyrspld=imagecopyresampled($pic,$source,0,0,0,$pic_new_width,$pic_new_height,$width,$height);
ImageAlphabling($pic,false);
//拯救阿尔法
imagesavealpha($pic,true);
标题('Content-type:image/png');
如果(版本比较(PHP版本,'5.1.2','