开发者

Tearing eyeballs out, PHPThumb class on shared hosting is failing

UPDATE & SOLUTION: Everyone, for whoever has this problem in the future, I figured out how to solve it. If you use the PHPThumb class, you MUST import the settings from the config file, as it will not do this otherwise. I discovered this by opening the testing file that Clint gave. To do so, insert this code after you define the object:

if (include_once($PATH . 'phpThumb.config.php')) {
    foreach ($PHPTHUMB_CONFIG as $key => $value) {
        $keyname = 'config_'.$key;
        $phpThumb->setParameter($keyname, $value);
    }
}

Thanks to the people who attempted to help, and thanks Clint for at least giving me somewhere to look.


Original Question:

Before I cannot read this message due to my newfound blindness, I need help with something. And before you go farther, I must warn you that I have to link to other sites to show you the problems. So get ready to have a few tabs open.

So I am using PHPthumb to generate images for my gallery website. It was going along really great actually until I uploaded the script so that my business partner could start showing them (clients) an alpha stage of the script (I know it says beta).

http://speakwire.net/excitebeta2/?m=2

The problem becomes very obvious on the two gallery pages, which I happened to link to. The images are not being created at all. If you go into the admin panel, they seem to work, but that is merely a cache generated from my desktop. I have meticulously stopped at every step and even tried to manipulate the class code. I looked for other scripts but they did not help me, because they did not have what I needed. Because the code is proprietary though, I cannot share it. I bet you are thinking "Oh my farce god", but here is something you can look at - because I am able to replicate the same problem with the code I got before.

http://speakwire.net/phpthumbtest/

The second website has the EXACT same structure and code as: http://mrphp.com.au/code/image-cache-using-phpthumb-and-modrewrite

The few exceptions are allowing the 100x100 parameters, but those are supposed to be changed and I know that is not causing the error, because its very existence is optional and removing it only allows people to do naughty things. The second is the thing I made only after the error persisted, and that was chmod(dirname($path), 0777); because for some weird reason, mkdir won't give the folder 777 permissions.

The old image: http://speakwire.net/phpthumbtest/images/flowerupright.JPG

The new image: http://speakwire.net/phpthumbtest/thumbs/100x100/images/flowerupright.JPG

As seen in the new image,开发者_JAVA技巧 it is unable to write the file. This happens to be the fault of PHPThumb. Whether that be the lack of parameters given, or the hosting does not permit.

Which brings me to the point, the script works superbly on my desktop WAMP, but fails when on the GoDaddy hosting. My business partner is going to open up an account on the hosting we plan to have people on soon, but the problem is still existent and if it is happening here, it most certainly can happen there too. Even though, it won't be on GoDaddy's servers later.

The specific place where it is failing I will insert here, but the rest you need to open up the mrphp.com.au site to see. It is way to long to post here.

require('../phpthumb/phpthumb.class.php');
$phpThumb = new phpThumb();
$phpThumb->setSourceFilename($image);
$phpThumb->setParameter('w',$width);
$phpThumb->setParameter('h',$height);
$phpThumb->setParameter('f',substr($thumb,-3,3)); // set the output format
//$phpThumb->setParameter('far','C'); // scale outside
//$phpThumb->setParameter('bg','FFFFFF'); // scale outside
if (!$phpThumb->GenerateThumbnail()) {  // RETURNS FALSE FOR SOME REASON
    error('cannot generate thumbnail');  // And is called due to fail.
}

I would love you long time whoever helps me with this, because I have spent essentially all my free time for the last few days, including time meant to be sleeping, trying to figure this out.

EDIT: http://speakwire.net/phpthumbtest/index2.php

I added this as Clints suggestion, seems imagemagick isn't working, could that really be the problem and how would I fix it?


Sounds like a permissions issue. Make sure whatever folder you are writing to, apache has write access.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜