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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.