PDA

View Full Version : Would this work?


Tohou
04-28-2008, 12:30 PM
if (file_exists('.$page .'.jpg')) {
echo "Thumbnail";
} else {
$Image = $row['Image'];
$url = $Image;

preg_match("/[^\/]+$/",$url,$matches);

$file_name = $matches[0];
$filename_end = "/files/'.$file_name.'";
exec ('mplayer -ss 60 -nosound -vo jpeg -frames 2 ".$filename_end."');
exec ('cp 00000001.jpg ".$page.".jpg');
exec ('rm 00000001.jpg');
}



I think:

$filename_end = "/files/'.$file_name.'";
exec ('mplayer -ss 60 -nosound -vo jpeg -frames 2 ".$filename_end."');


is wrong but don't know really the proper way.

Nile
04-28-2008, 12:54 PM
Try this:

$filename_end = "/files/".$file_name;
exec ('mplayer -ss 60 -nosound -vo jpeg -frames 2 '.$filename_end);
exec ('cp 00000001.jpg '.$page.'.jpg');
exec ('rm 00000001.jpg');

If your using a single quote('), then you need to put variables as: '.$var.', if your using double quotes("), put variables as ".$var.", if its at the end of the line, you don't need to include the: ." or .'
(I've never used the exec function so I don't know)

Nile
04-30-2008, 04:56 PM
The rep was great, thanks. ;) But you also wanna post something saying that I solved it.

Tohou
05-01-2008, 10:10 AM
Solved - Just whatever the stuff I did for the mplayer command didn't do as it was told.
I really should output it to a log.

Fate93
05-01-2008, 03:45 PM
Adding on to Nile, with double quotes ("") it's not even necessary to do ".$var.", you could to "hello $var";