phpthumb работает в разработке Ubuntu НЕ на сервере Ubuntu - PullRequest
0 голосов
/ 24 декабря 2010

Я кросс-пост в http://support.silisoftware.com/phpBB3/viewtopic.php?f=2&t=255&p=806 но я обновлю обе стороны, если ответ придет.

Я использую Capistrano для развертывания на моем сервере. так что есть символическая ссылка.

как на компьютере разработчика, так и на сервере используется Ubuntu 10.04

Код

в обоих случаях одинаков, но на машине разработчика проблем не было, а на сервере проблемы.

это список пакетов php для моего сервера

dpkg -l | grep php
ii  libapache2-mod-php5               5.3.2-1ubuntu4.5                  server-side, HTML-embedded scripting languag
ii  php5                              5.3.2-1ubuntu4.5                  server-side, HTML-embedded scripting languag
ii  php5-cli                          5.3.2-1ubuntu4.5                  command-line interpreter for the php5 script
ii  php5-common                       5.3.2-1ubuntu4.5                  Common files for packages built from the php
ii  php5-curl                         5.3.2-1ubuntu4.5                  CURL module for php5
ii  php5-gd                           5.3.2-1ubuntu4.5                  GD module for php5
ii  php5-imagick                      2.1.1RC1-1build3                  ImageMagick module for php5
ii  php5-mcrypt                       5.3.2-0ubuntu1                    MCrypt module for php5
ii  php5-mysql                        5.3.2-1ubuntu4.5                  MySQL module for php5
ii  phpmyadmin                        4:3.3.2-1                         MySQL web administration tool

Отладка сообщений на моей машине для разработки.

2010-12-23 15:37:31 Error: Array
(
[0] => phpThumb() v1.7.9-200805132119 in file "phpthumb.class.php" on line 216
[1] => setSourceFilename(uploads/products/8cb42ecccafe-2.jpg) set $this->sourceFilename to "uploads/products/8cb42ecccafe-2.jpg" in file "phpthumb.class.php" on line 243
[2] => file_exists(/usr/bin/convert) = 1 in file "phpthumb.class.php" on line 1105
[3] => is_executable(/usr/bin/convert) = 1 in file "phpthumb.class.php" on line 1106
[4] => using ImageMagick path from $this->config_imagemagick_path (/usr/bin/convert) in file "phpthumb.class.php" on line 1108
[5] => ImageMagick version checked with ""/usr/bin/convert" --version" in file "phpthumb.class.php" on line 1152
[6] => ImageMagick did not return recognized version string (Version: ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP) in file "phpthumb.class.php" on line 1158
[7] => ImageMagick convert --version says "" in file "phpthumb.class.php" on line 1160
[8] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 888
[9] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 899
[10] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 916
[11] => $this->sourceFilename set to "/var/www/wp/app/webroot/uploads/products/8cb42ecccafe-2.jpg" in file "phpthumb.class.php" on line 817
[12] => setCacheDirectory() starting with config_cache_directory = "" in file "phpthumb.class.php" on line 923
[13] => $this->config_cache_directory () is not a directory in file "phpthumb.class.php" on line 959
[14] => SetCacheFilename() failed because $this->config_cache_directory is empty in file "phpthumb.class.php" on line 3076
[15] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 2920
[16] => GetImageSize(/var/www/wp/app/webroot/uploads/products/8cb42ecccafe-2.jpg) says image is 426x318 in file "phpthumb.class.php" on line 2930
[17] => SetOrientationDependantWidthHeight() starting with "426"x"318" in file "phpthumb.class.php" on line 2899
[18] => SetOrientationDependantWidthHeight() setting w="32", h="32" in file "phpthumb.class.php" on line 2915
[19] => EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3015
[20] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3273
[21] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1252
[22] => phpThumb_tempnam() returning "/var/www/wp/app/webroot/pThumbHd2wYY" in file "phpthumb.class.php" on line 3929
[23] => ImageMagickSwitchAvailable(thumbnail) = 1 in file "phpthumb.class.php" on line 1192
[24] => ImageMagickSwitchAvailable(density) = 1 in file "phpthumb.class.php" on line 1192
[25] => GetImageSize(/var/www/wp/app/webroot/uploads/products/8cb42ecccafe-2.jpg) SUCCEEDED: Array
(
[0] => 426
[1] => 318
[2] => 2
[3] => width="426" height="318"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
in file "phpthumb.class.php" on line 1332
[26] => GetImageSize(/var/www/wp/app/webroot/uploads/products/8cb42ecccafe-2.jpg) returned [w=426;h=318;f=2] in file "phpthumb.class.php" on line 1337
[27] => source dimensions set to 426x318 in file "phpthumb.class.php" on line 1340
[28] => SetOrientationDependantWidthHeight() starting with "426"x"318" in file "phpthumb.class.php" on line 2899
[29] => SetOrientationDependantWidthHeight() setting w="32", h="32" in file "phpthumb.class.php" on line 2915
[30] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 1824
[31] => ImageMagickSwitchAvailable(quality;interlace) = 1 in file "phpthumb.class.php" on line 1189
[32] => ImageMagick called as ("/usr/bin/convert" -density 150 -background "#FFFFFF" -thumbnail 32x32 -quality 75 -interlace line "/var/www/wp/app/webroot/uploads/products/8cb42ecccafe-2.jpg[0]" jpeg:"/var/www/wp/app/webroot/pThumbHd2wYY" 2>&1) in file "phpthumb.class.php" on line 1843
[33] => GetImageSize(/var/www/wp/app/webroot/pThumbHd2wYY) returned [w=32;h=24;f=2] in file "phpthumb.class.php" on line 1864
[34] => ImageMagickThumbnailToGD::ImageCreateFromJPEG() succeeded, $this->gdimg_source is now (32x24) in file "phpthumb.class.php" on line 1870
[35] => ImageMagickThumbnailToGD() returning $this->IMresizedData (815 bytes) in file "phpthumb.class.php" on line 1871
[36] => deleting "/var/www/wp/app/webroot/pThumbHd2wYY" in file "phpthumb.class.php" on line 1876
[37] => ImageMagickThumbnailToGD() succeeded in file "phpthumb.class.php" on line 3278
[38] => Not using EXIF thumbnail data because $this->gdimg_source is already set in file "phpthumb.class.php" on line 3325
[39] => CalculateThumbnailDimensions() [x,y,w,h] initially set to [0,0,32,24] in file "phpthumb.class.php" on line 2785
[40] => CreateGDoutput() returning canvas "32x24" in file "phpthumb.class.php" on line 2894
[41] => ImageResizeFunction($o, $s, 0, 0, 0, 0, 32, 24, 32, 24) in file "phpthumb.class.php" on line 3908
[42] => memory_get_usage() after copy-resize = 13097812 in file "phpthumb.class.php" on line 390
[43] => memory_get_usage() after ImageDestroy = 13097936 in file "phpthumb.class.php" on line 392
[44] => AntiOffsiteLinking() says this is allowed in file "phpthumb.class.php" on line 2087
[45] => skipping AlphaChannelFlatten() because !$this->is_alpha in file "phpthumb.class.php" on line 2143
[46] => GenerateThumbnail() completed successfully in file "phpthumb.class.php" on line 404
)


2010-12-24 01:48:35 Error: Array
(
    [0] => phpThumb() v1.7.9-200805132119 in file "phpthumb.class.php" on line 216
    [1] => setSourceFilename(uploads/products/8cb42ecccafe-1.jpg) set $this->sourceFilename to "uploads/products/8cb42ecccafe-1.jpg" in $
    [2] =>   file_exists(/usr/bin/convert) = 1 in file "phpthumb.class.php" on line 1105
    [3] => is_executable(/usr/bin/convert) = 1 in file "phpthumb.class.php" on line 1106
    [4] => using ImageMagick path from $this->config_imagemagick_path (/usr/bin/convert) in file "phpthumb.class.php" on line 1108
    [5] => ImageMagick version checked with ""/usr/bin/convert" --version" in file "phpthumb.class.php" on line 1152
    [6] => ImageMagick did not return recognized version string (Version: ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP) in file "phpthumb.class.php" on line 1158
    [7] => ImageMagick convert --version says "" in file "phpthumb.class.php" on line 1160
    [8] => $AvailableImageOutputFormats = array(text;ico;bmp;wbmp;gif;png;jpeg) in file "phpthumb.class.php" on line 888
    [9] => $this->thumbnailFormat set to $this->config_output_format "jpeg" in file "phpthumb.class.php" on line 899
    [10] => $this->thumbnailQuality set to "75" in file "phpthumb.class.php" on line 916
    [11] => $this->sourceFilename set to "/var/www/ombi60.biz/releases/20101224014356/app/webroot/uploads/products/8cb42ecccafe-1.jpg" i$
    [12] => setCacheDirectory() starting with config_cache_directory = "" in file "phpthumb.class.php" on line 923
    [13] => $this->config_cache_directory () is not a directory in file "phpthumb.class.php" on line 959
    [14] => SetCacheFilename() failed because $this->config_cache_directory is empty in file "phpthumb.class.php" on line 3076
    [15] => starting ExtractEXIFgetImageSize() in file "phpthumb.class.php" on line 2920
    [16] => GetImageSize(/var/www/ombi60.biz/releases/20101224014356/app/webroot/uploads/products/8cb42ecccafe-1.jpg) says image is 426x$
    [17] => SetOrientationDependantWidthHeight() starting with "426"x"318" in file "phpthumb.class.php" on line 2899
    [18] => SetOrientationDependantWidthHeight() setting w="32", h="32" in file "phpthumb.class.php" on line 2915
    [19] => EXIF thumbnail extraction: (size=0; type=""; 0x0) in file "phpthumb.class.php" on line 3015
    [20] => starting SourceImageToGD() in file "phpthumb.class.php" on line 3273
    [21] => $this->useRawIMoutput=true after checking $UnAllowedParameters in file "phpthumb.class.php" on line 1252
    [22] => phpThumb_tempnam() returning "/var/www/ombi60.biz/releases/20101224014356/app/webroot/pThumbsEVu99" in file "phpthumb.class.$
    [23] => ImageMagickSwitchAvailable(thumbnail) = 1 in file "phpthumb.class.php" on line 1192
    [24] => ImageMagickSwitchAvailable(density) = 1 in file "phpthumb.class.php" on line 1192
    [25] => GetImageSize(/var/www/ombi60.biz/releases/20101224014356/app/webroot/uploads/products/8cb42ecccafe-1.jpg) SUCCEEDED: Array
(
    [0] => 426
    [1] => 318
    [2] => 2
    [3] => width="426" height="318"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)
 in file "phpthumb.class.php" on line 1332
    [26] => GetImageSize(/var/www/ombi60.biz/releases/20101224014356/app/webroot/uploads/products/8cb42ecccafe-1.jpg) returned [w=426;h=$
    [27] => source dimensions set to 426x318 in file "phpthumb.class.php" on line 1340
    [28] => SetOrientationDependantWidthHeight() starting with "426"x"318" in file "phpthumb.class.php" on line 2899
    [29] => SetOrientationDependantWidthHeight() setting w="32", h="32" in file "phpthumb.class.php" on line 2915
    [30] => Remaining $this->fltr after ImageMagick: (array(0) { } ) in file "phpthumb.class.php" on line 1824
    [31] => ImageMagickSwitchAvailable(quality;interlace) = 1 in file "phpthumb.class.php" on line 1189
    [32] => ImageMagick called as ("/usr/bin/convert" -density 150 -background "#FFFFFF" -thumbnail 32x32 -quality 75 -interlace line  "$
    [33] => GetImageSize(/var/www/ombi60.biz/releases/20101224014356/app/webroot/pThumbsEVu99) returned [w=32;h=24;f=2] in file "phpthum$
    [34] => ImageMagickThumbnailToGD::ImageCreateFromJPEG() succeeded, $this->gdimg_source is now (32x24) in file "phpthumb.class.php" o$
    [35] => ImageMagickThumbnailToGD() returning $this->IMresizedData (815 bytes) in file "phpthumb.class.php" on line 1871
    [36] => deleting "/var/www/ombi60.biz/releases/20101224014356/app/webroot/pThumbsEVu99" in file "phpthumb.class.php" on line 1876
    [37] => ImageMagickThumbnailToGD() succeeded in file "phpthumb.class.php" on line 3278
    [38] => Not using EXIF thumbnail data because $this->gdimg_source is already set in file "phpthumb.class.php" on line 3325

 [39] => CalculateThumbnailDimensions() [x,y,w,h] initially set to [0,0,32,24] in file "phpthumb.class.php" on line 2785
    [40] => CreateGDoutput() returning canvas "32x24" in file "phpthumb.class.php" on line 2894
    [41] => ImageResizeFunction($o, $s, 0, 0, 0, 0, 32, 24, 32, 24) in file "phpthumb.class.php" on line 3908
    [42] => memory_get_usage() after copy-resize = 21742752 in file "phpthumb.class.php" on line 390
    [43] => memory_get_usage() after ImageDestroy = 21742912 in file "phpthumb.class.php" on line 392
    [44] => AntiOffsiteLinking() says this is allowed in file "phpthumb.class.php" on line 2087
    [45] => skipping AlphaChannelFlatten() because !$this->is_alpha in file "phpthumb.class.php" on line 2143
    [46] => GenerateThumbnail() completed successfully in file "phpthumb.class.php" on line 404
    [47] => !$this->config_allow_src_above_docroot therefore setting "/var/www/ombi60.biz/current/app/webroot//uploads/products/thumb/ic$
    [48] => RenderToFile() failed because "/" is not writable in file "phpthumb.class.php" on line 531
)

Ответы [ 3 ]

1 голос
/ 18 февраля 2012

Это можно исправить с помощью функции setParameter:

$phpThumb->setParameter('config_allow_src_above_docroot', true);
1 голос
/ 24 декабря 2010

решение - установить строку phpthumb.class.php 142

var $ config_allow_src_above_docroot = true;

это, вероятно, связано с тем, что капистрано использует символическую ссылку, но не может быть уверен.

0 голосов
/ 20 сентября 2016

У меня такая же ситуация, я решил 'root path' FCPATH в codeigniter
Или (define('FCPATH', dirname(__FILE__).'/'); в вашем файле index.php)
Или (define('FCPATH', __DIR__.'/'); в вашем файле index.php)
Пример: define('FCPATH', 'C:/xampp/htdocs/your_project/');

$relative_path = 'images/upload/demo.jpg';
$phpThumb->RenderToFile(FCPATH .$relative_path);
...