Jump to content

[SOLVED] createThumbnail() - error


next

Recommended Posts

i'm following a tutorial to create a gallery and it uses createThumbnail() in it's code, as far as i understand from authors explanation it's a GD function, but i keep getting an error:

Fatal error: Call to undefined function createThumbnail() in E:\WOS\www\gallery\add_album.php on line 16

What's wrong here?

Code:

<?php
require("config.php");
include("header.php");

if($_POST['submitted']) {
$albumName = $_POST['album'];
$description = $_POST['description'];
$imageName = $_FILES['image']['name'];
$tmpName = $_FILES['image']['tmp_name'];

$ext = strrchr($imageName, ".");
$newName = md5(mt_rand()).$ext;
$imgPath = ALBUM_IMG_DIR . $newName;

//resize
$result = createThumbnail($tmpName, $imgPath, THUMBNAIL_WIDTH);

if($result == false) {
	echo "error during upload.";
	exit();
}
if(!get_magic_quotes_gpc()) {
	$albumName = addslashes($albumName);
	$description = addslashes($description);
}
$query = "INSERT INTO tbl_album(al_name, al_description, al_image, al_date)
			VALUES('$albumName', '$description', '$newName', NOW())";
mysql_query($query) or die('Error, add album failed : ' .    mysql_error());

header("location: http://localhost/gallery/list_album.php");
exit();
}
?>

<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<ul id="form">
	<li><label for="album">Album Name:</label><input type="text" id="album" name="album" maxlength="64" /></li>
	<li><label for="description">Description:</label><textarea rows="5" cols="15" name="description"></textarea></li>
	<li>
		<label for="image">Image:</label>
		<input type="file" id="image" name="image" />
	</li>
	<li><input type="submit" name="submit" value="Add Album" /><input type="submit" name="cancel" value="cancel" /></li>
	<input type="hidden" name="submitted" value="true" />
</ul>
</form>
<?php
include("footer.php");
?>

 

here's is the exact line:  $result = createThumbnail($tmpName, $imgPath, THUMBNAIL_WIDTH);

 

THUMBNAIL_WIDTH equals to 60.

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/108087-solved-createthumbnail-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.