2010-04-28, 16:27
transcender Wrote:I dont really know sql or what your refrencing but couldnt strip the extension before the SQL query like: stfilename =left(strfilename)-4 cause i think LEFT is a sql command.
it seems left or right do not work with sqlite, but I can use a nested replace command. Not perfect but it does the job.
Code:
select path.strPath || replace(replace(files.strFilename, '.mkv',''),'.avi','') || '-fanart.jpg' from path, files, movie where path.strContent='movies' and files.idPath='1' and movie.idFile=files.idFile
now my problem is the php code.
this is the current code:
Quote:public function get_thumb()
{
global $MODULE;
$MODULE->load("image");
list($thumb) = $this->parent->db->sql_fetchrow($this->parent->db->sql_query("SELECT c08 FROM movie WHERE idMovie = '".$this->id."'"));
preg_match_all("|<thumb.*>(.*)</thumb>|U", str_replace("<thumbs>", "", $thumb), $matches);
return image::get("movie", $matches[1][0]);
}
this is what I have changed it to:
Quote:public function get_thumb()I get no errors when I run indexing.php but it doesn't process any images. is my syntax incorrect? remind you, I know absolutely nothing about php... I'm guessing that return image part is incorrect...
{
global $MODULE;
$MODULE->load("image");
list($thumb) = $this->parent->db->sql_fetchrow($this->parent->db->sql_query("select path.strPath || replace(replace(files.strFilename, '.mkv',''),'.avi','') || '-fanart.jpg' from path, files where path.strContent='movies' and files.idPath='1' and movie.idFile=files.idFile and movie.idMovie = '".$this->id."'"));
return image;
}