Thumbnails...need help please.
Moderator: General Moderators
Re: Thumbnails...need help please.
hmm..still can't get it to go..what could I be doing wrong?
I don"t get it..
I don"t get it..
Re: Thumbnails...need help please.
I certainly can't guess. What can't you get going, exactly?
Re: Thumbnails...need help please.
I have the createThumbs.php file and the thumbnail.inc.php file in the main folder of my project. The image folder is right there.
For example:
/var/www/Final3/createThumbs.php
/var/www/Final3/thumbnail.inc.php
images are at:
/var/www/Final3/images/
I have typed into my browser(Chrome) http://localhost/Final3/createThumbs.php
I get a white screen with an error:
the website encountered an error.
If I go to localhost/Final3/index.php I get my frontpage, and can browse the site.
My image folder does not change when typing in
http:// localhost/Final3/createThumbs.php
I just don't get what I am doing wrong. I have created guis and how to's for other things, way more complicated than this, and still, here I am..lol
For example:
/var/www/Final3/createThumbs.php
/var/www/Final3/thumbnail.inc.php
images are at:
/var/www/Final3/images/
I have typed into my browser(Chrome) http://localhost/Final3/createThumbs.php
I get a white screen with an error:
the website encountered an error.
If I go to localhost/Final3/index.php I get my frontpage, and can browse the site.
My image folder does not change when typing in
http:// localhost/Final3/createThumbs.php
I just don't get what I am doing wrong. I have created guis and how to's for other things, way more complicated than this, and still, here I am..lol
Re: Thumbnails...need help please.
Do you have error reporting on? That's a particularly worthless error message. Did you at least get an error code?
Re: Thumbnails...need help please.
what kind of response am I supposed to get? I breakdown of the pics?I moved thecreateThumb.php to here:
Is that right? I get just a white screen, no error with it sitting there. No thumbnails either.
If I move the createThumbs.php to below the ?> I get just createThumbs() on a white page, but again, no thumbnails..???
Code: Select all
<?php
require_once('thumbnail.inc.php');
/**
* Create thumbnail images for the images directory!
*/
function createThumbs() {
$pathName = dirname(__FILE__) . '/images/';
// create an array containing the list of thumbnails
// this will be passed from the controller to the view
$thumbFiles = array();
// DirectoryIterator is part of the Standard PHP library
foreach(new DirectoryIterator($pathName) as $fileInfo) {
$fileName = $fileInfo->getFileName();
if ($fileInfo->isDir()) {
continue;
}
// TODO: we should also check if this file
// already has a thumbnail generated!!
// skip thumbnails that have already been generated
//
$pos = strpos($fileName, "_Thumb.");
if ($pos !== false) {
//$thumbFiles[] = $thumbFileName;
continue;
}
$thumb = new Thumbnail($pathName . $fileName);
$thumb->resize(200, 100);
// create a new fileName with 'Small' in it
// (e.g. pic.jpg -> picSmall.jpg)
//
$thumbFileName =
substr_replace($fileName, "_Thumb", strpos($fileName, '.'));
// add the file extension back
$thumbFileName .= '.' . substr($fileName, -3);
$thumb->save($pathName . $thumbFileName);
// add this to our array containing the list of thumbnail files
$thumbFiles[] = $thumbFileName;
//echo $fileInfo . "\n";
}
return $thumbFiles;
createThumbs();
}
?>If I move the createThumbs.php to below the ?> I get just createThumbs() on a white page, but again, no thumbnails..???
Re: Thumbnails...need help please.
No, you've got the function call inside the function definition. Move it outside the last closing brace but inside the closing PHP tag.
Code: Select all
function createThumbs()
{
// Lots of stuff here
}
createThumbs();
?>Re: Thumbnails...need help please.
ok..I have moved that, now I get error: unknown file format in the top left of the browser and that is it. Everything in my images folder is a jpeg.
Re: Thumbnails...need help please.
Doesn't say which file it choken on? Did it create any thumbs at all? Have you checked for dotfiles?
Re: Thumbnails...need help please.
No it just said error: unknown file format
The website encountered an error while retrieving http://localhost/Final3/createThumbs.php. It may be down for maintenance or configured incorrectly.
The website encountered an error while retrieving http://localhost/Final3/createThumbs.php. It may be down for maintenance or configured incorrectly.
Re: Thumbnails...need help please.
I have checked with the terminal for hidden files, and nothing..
-
litebearer
- Forum Contributor
- Posts: 194
- Joined: Sat Mar 27, 2004 5:54 am
Re: Thumbnails...need help please.
Not to further confuse the OP; however, http://www.binarymoon.co.uk/projects/timthumb/