Jump to content

Unable to locate resource in this object


rondog

Recommended Posts

I am trying to make a thumbnail from an FLV using ffmpeg and ffmpeg-php. I got them all installed.

 

This is my script:

<?php
$extension = "ffmpeg";
$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;
$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;

// load extension
if(!extension_loaded($extension))
{
    dl($extension_soname) or die("Can't load extension $extension_fullname\n");
}

include("../connect.php");

header("Content-type: image/jpeg");
$id 		= $_GET['id'];
$query 		= mysql_query("SELECT filename FROM video WHERE id = '$id'");
$result 	= mysql_fetch_array($query);
$moviefile 	= "../../../../armsmedia/videos/".$result['filename'];
$mov 		= new ffmpeg_movie($moviefile,false);
$img 		= $mov->getFrame(1);
$showImg 	= $img->toGDImage();
$mkNewImg 	= new ffmpeg_frame($showImg);
$maxWid 	= 150;
$oldWid 	= $mkNewImg->getWidth();
if($oldWid > $maxWid) {
$newWid = $maxWid;
}
$newHgt 	= $newWid / $movRatio;
$mkNewImg->resize($newWid,$newHgt);
$newImg 	= $mkNewImg->toGDImage();
imagejpeg($newImg,$mkThumbFile,40);
imagedestroy($newImg);
?>

 

I get a 500 Internal server error so I checked my apache logs and it is saying:

 

Unable to locate ffmpeg_frame resource in this object. in /var/www/html/inc/video/thumbnail.php on line 24 which is pointing to:

$oldWid 	= $mkNewImg->getWidth();

 

If I do a print_r($showImg) it returns: Resouce id #7

Any ideas?

I am starting to think their is a problem with my GD Library. This is the API docs for ffmpeg_frame()

 

http://ffmpeg-php.sourceforge.net/doc/api/ffmpeg_frame.php and it is saying it will be unavailable if GD is not enabled, however, my php info says it is enabled..

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.