PK's MovieDB Release.V3.0 (Dynamic PHP View)

If you made a template for printing or HTML export, you can offer it to the others here. You can also ask here for help about these templates
sandmanweb
Posts: 96
Joined: 2006-03-12 01:07:41

Ma contribution :)

Post by sandmanweb »

Voici les fichiers qui vous permettront d'ajouter les commentaires et évaluations des visiteurs sur votre liste PK's MovieDB.

C'est mon premier essais en PHP. Alors soyez indulgent si il n'est pas parfait ;)
Mais je vous garanti que ça fonctionne.

Il faut juste suivre les instructions contenues dans lisez-moi.txt

Évaluations par Alain Lizotte

-------------------------------------

Here are the files to add comments and ratings by visitors to your PK's MovieDB database.

That's my first try with PHP. So don't hate me if it's not perfect ;)
But it does work.

Just make sure you follow the instructions listed in "read me.txt"

Ratings by Alain Lizotte

-------------------------------------

Image
prikichi
Posts: 3
Joined: 2008-07-06 16:51:54

Comment script and other amendments

Post by prikichi »

To Sandmanweb:

Thanks a lot for your effort. It helped me a lot. In the meantime I've translated it into English and I combined your 2 tables into 1, so a user can leave a rating or a comment or both. I'm planning to give it a little more effort to use the alrallready known database parameters and maybe I'll link it to a table with known usernames with passwords, to avoid complete strangers from messing up your rating or comments. When I'm all finished I'll get back to you.

To all of you reading:
Till I started using PK movies I didnt't know a bit about PHP or MySQL but I had a history as a programmer in COBOL and Oracle PL SQL and I knew a bit about HTML. You all got me addicted to PHP. I still have lots to learn but I've added some interesting features to my version of PKMovieDB and still have several things I will change in it. With thanks to all who helped me so far in this forum (I read all pages!!) I have accomplished (or will in the near future) the following features:
- Own rating next to IMDB rating (with thanks to Sandmanweb for his script)
- More advanced search functions: search within all or within selected categories or within earlier search (narrow search results)
- Link the actors on the details page to the IMDB Names search.
- Multi table support, in my case movies next to series
- search on names containing a '-' solved (thanks Kazgor)
- dutch language file
- showing random movies only when you first enter the detail-view.
- adding a subheader for selected movies
- a new serie of template files with a variable set of covers in cover_view depending on your screen width, imdb link replaced by button
- Split up of trivia, awards and rating as mentioned earlier in this forum.
- Varying width of movie information, depending on individual screen width.
- several minor changes in display and reference.

When I'm finished (for the moment) I'll share it all with you, so keep looking, give me about 2 weeks. After that I have the following in mind:
- adding checkboxes to the list view (and maybe detail view)
- automatically import actor bio and picture into ant independant table within pk
- including an optional login structure

Unfortunately I can't give you a link to view it all, since I'm using PK only on my own local network. I will publish every important change in this thread. If you can't wait or if you're interested in any specific function, you can mail me at karin#hetsignaal#com. Replace hashes by respectively @ and .

Thanks again for anyone on this forum who helped me (probably unknowingly).

Prikichi
kazgor
Posts: 175
Joined: 2006-05-08 13:13:52
Contact:

Post by kazgor »

@Sandmanweb... for some reason clicking on your link does work for me.... can you check if works ok for anyone else.

@Prikichi, those new updates sure sound interesting... I know for myself i've used this script to learn a lot about PHP.

I should really post my hack i've done since i post here on Page 1 :) it will be nice to try and unify all the peices we've all done here and come our with a 3.5 version of our own :)

here my site with all my changes in so far

http://www.brunesmedia.co.uk/movies

My details page i only show the Trivia stuff, but its can display Awards, ratings and comments in a similar manner
kazgor
Posts: 175
Joined: 2006-05-08 13:13:52
Contact:

Re: quote in image name

Post by kazgor »

prikichi wrote:Hi there,

Great script. Thanks a lot!!

A question. I've got some movies with quotes in the title like "Baby's day out". I'm using formattedtitle as picturename, so the quote is also in the name of the jpg. The quote is in the mysql table and PKmovies represents the name well, including the "'".

The 'default image' is not shown, so I think everything still goes well in the resize.php part:

$default_img = "default_cover.jpg";
$img = $_GET[img];

// Check the file exists, if not use the default
if (file_exists($img) == FALSE) {
$img = $default_img;

But when the file is finally retrieved, all I get is a red cross. I know I can change the picturenames, but is there a solution solving the quote question?
I've played around with htmlentities, add/stripslashes and str_replace, but so far it didn't help. Anyone who can help?

Update: I'm using PK Movie DB on localserver, XAMPP latest version under windows XP SP2

Thanks!!
Hi Have you still got problem on this one?

Just way i do it is i name my pictures along the lines of MyMovies001.jpg MyMovies002.jpg

Basically in ANT, i used the EXPORT Filename + Movie Number.

also in the MDB3.PHP in the auto import funtion i have the follow mod

Code: Select all

$query = "update ".$this->config['mysql']['table']." set picturename = 'default_cover.jpg' where picturename ='';";
                    $this->db->query($query);
this scans the database and if there no picture set, then points the field to the default cover image.
sandmanweb
Posts: 96
Joined: 2006-03-12 01:07:41

Post by sandmanweb »

@prikichi

Glad to see it helped you :)

As I said, this was my first attempt with PHP and MySql.

I'm sure you will improve it a lot.

The registered user is a good idea, but in my case I would like to have the option to keep it available to anyone that provide a name in the form. Because my movie database already require a password to access it. So I know the people that log in ;)

You did a lot of work customising the MovieDB and I'm glad if I helped you improving it a bit.

I'm looking forward for the final result :)

:grinking:


@kazgor

Look at your PV.
I can send it to you by email if you wish.
mulderx
Posts: 4
Joined: 2008-07-21 20:54:59

Post by mulderx »

Thanks to everyone who contributed to this wonderful template. :grinking:


I have everything setup up fine and running, but I like to make a little change.

For example,
Go to kazgor site: http://www.brunesmedia.co.uk/movies/
Click on the "Action" category
Then click on one of the actors links. (In this case, I will use Samuel L. Jackson in Jumper)
The above link will look like this: http://www.brunesmedia.co.uk/movies/ind ... ory=Action

Once you click on the link, the result page will bring up all the movies in the database starring Samuel L. Jackson in the "Action" category. I would like to change this so that the result page will bring up any movie in the database starring Samuel L. Jackson.

In other words, I would like to make all urls (actors, years, director, etc.) to make a global search on the database. So in this example, the link for Samuel L. Jackson would be: http://www.brunesmedia.co.uk/movies/ind ... Jackson%22

I hope someone understands what I'm taking about.
daquint
Posts: 7
Joined: 2006-12-03 07:34:10

Post by daquint »

Hello,

I would like to use this template, but the links are dead on the original post.

Can someone point me in the right direction for the template, or link one of their own (based on PKs original)?

Thanks
mark
mulderx
Posts: 4
Joined: 2008-07-21 20:54:59

Post by mulderx »

daquint
Posts: 7
Joined: 2006-12-03 07:34:10

Post by daquint »

thanks mulderx!
kazgor
Posts: 175
Joined: 2006-05-08 13:13:52
Contact:

Post by kazgor »

if i get chance i'll upload my version tomorrow.. after that im on holiday for 3weeks so wont have access to a PC.

Here's my version for those interested --> http://brunesmedia.co.uk/MoviesDB.zip


Mulderx... I've see your Search request and i know what you mean.. Im sure its can be done just not had the time to look at it.. Just say though that this was by done by design.
mulderx
Posts: 4
Joined: 2008-07-21 20:54:59

Post by mulderx »

kazgor wrote:if i get chance i'll upload my version tomorrow.. after that im on holiday for 3weeks so wont have access to a PC.

Here's my version for those interested --> http://brunesmedia.co.uk/MoviesDB.zip
Hey, I wanted to take a lot at your version, but the file is corrupted. Can you re-upload it?
Mulderx... I've see your Search request and i know what you mean.. Im sure its can be done just not had the time to look at it.. Just say though that this was by done by design.
If anyone one has time, I'll be thankful. ;)
axelv
Posts: 19
Joined: 2008-04-08 22:28:18

Post by axelv »

Hi all.
Sorry for my english, I'm italian.
This is my first time I try to use this template.
I have a web space and I have mysql5 database.
I uploaded all these file in my web space root:
Image

Then I exported the sql file from AntMDB.

Now, what I do in the file mdb_config.inc? Wich are the settings I must change?
This is the first time I use php.

Someone can help me?
axelv
Posts: 19
Joined: 2008-04-08 22:28:18

Post by axelv »

YES!! It's works fine!!
I did it!

It's ok, but there are 2 problem:
all the corner are black and there is a problem in audioformat string.

Image

What can i do?
mulderx
Posts: 4
Joined: 2008-07-21 20:54:59

Post by mulderx »

edit the file: ..moviedb\templates\default\detail_view.tpl

find the line with the error and comment out the audio format line by adding "#" in front of the line to remove it. Or try replacing the line with the error with:

Code: Select all

<div class='audioformat'><b>$LANG[AUDIOFORMAT]: </b><a href='$MOVIE[AUDIOFORMAT_HREF]'>$MOVIE[AUDIOFORMAT]</a></div>
axelv
Posts: 19
Joined: 2008-04-08 22:28:18

Post by axelv »

I haven't that line! :hum:
But I add it and the problem is solved.

Now, what can I do for delete the black corner as I show you in the image??
MCVampire
Posts: 30
Joined: 2006-04-05 02:26:01

Post by MCVampire »

Bon, le template à beaucoup évolué depuis le temps (environs 2 ans) et j'ai du mal à m'y retrouver. Puisque l'original ne semble plus accessible via le 1er lien, je me suis tourné vers celui de Surflife.

Hélas, trop de temps sans m'amuser avec du .php ... j'ai perdu la main. J'ai une erreur et je n'en trouve pas la cause;

Notice: Use of undefined constant NUM - assumed 'NUM' in c:\program files\easyphp1-8\www\mdb3.php on line 360

Quelqu'un pourrais me dire où est le problème svp ?
MCVampire
Posts: 30
Joined: 2006-04-05 02:26:01

Post by MCVampire »

Bon j'ai trouvé l'erreur
Ligne 360:

# Get NUM for every movie in database and store it in array
$query = "SELECT NUM FROM $this->mysql_table";
$result = $this->db->query($query);
while ($row = $result->fetch_assoc()) {
array_push($nummovies, $row[NUM]);
}
Il manque des ' à NUM ...
array_push($nummovies, $row['NUM']);
azer
Posts: 12
Joined: 2007-04-14 15:17:33

Post by azer »

I had some trouble with images showing red x'es so I made some fixes to resize.php

change:

Code: Select all

// Check the file exists, if not use the default
if (file_exists($_GET['img']) == FALSE) {
    $_GET['img'] = $default_img;
}
to:

Code: Select all

// Check the file exists, if not use the default
if ((file_exists($_GET['img']) == FALSE) || is_dir($_GET['img'])) {
    $_GET['img'] = $default_img;
}
helps if there is no picturename in the database for the movie

change:

Code: Select all

// If chaching is ON, check to see we already created this file.
if ($caching == TRUE) {
    $cachename = md5(print_r($_GET, TRUE)).".png";
    $cachefile = $cachedir.$cachename;
    if (file_exists($cachefile)) {
        // Output our cached file, that was easy.
        header("Content-Type: image/png");
        header("Expires: ".gmdate("D, d M Y H:i:s",time()+24*60*60));
        imagepng(imagecreatefrompng($cachefile));
        exit();
    }
}
to:

Code: Select all

// If chaching is ON, check to see we already created this file.
if ($caching == TRUE) {
    $cachename = md5(print_r($_GET, TRUE)).".png";
    $cachefile = $cachedir.$cachename;
    if (file_exists($cachefile)) {
        // Output our cached file, that was easy.
        header("Content-Type: image/png");
        header("Expires: ".gmdate("D, d M Y H:i:s",time()+24*60*60));
        if(imagepng(imagecreatefrompng($cachefile))){
        	exit();
		}
    }
}
removes some problems if the cached file is corrupt in some way.

And another fix to decrease the loading time of non cached images and increase the quality.
insert after $default_img = "default_cover.jpg"; :

Code: Select all

function fastimagecopyresampled (&$dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 2) {
  // Plug-and-Play fastimagecopyresampled function replaces much slower imagecopyresampled.
  // Just include this function and change all "imagecopyresampled" references to "fastimagecopyresampled".
  // Typically from 30 to 60 times faster when reducing high resolution images down to thumbnail size using the default quality setting.
  // Author: Tim Eckel - Date: 09/07/07 - Version: 1.1 - Project: FreeRingers.net - Freely distributable - These comments must remain.
  //
  // Optional "quality" parameter (defaults is 3). Fractional values are allowed, for example 1.5. Must be greater than zero.
  // Between 0 and 1 = Fast, but mosaic results, closer to 0 increases the mosaic effect.
  // 1 = Up to 350 times faster. Poor results, looks very similar to imagecopyresized.
  // 2 = Up to 95 times faster.  Images appear a little sharp, some prefer this over a quality of 3.
  // 3 = Up to 60 times faster.  Will give high quality smooth results very close to imagecopyresampled, just faster.
  // 4 = Up to 25 times faster.  Almost identical to imagecopyresampled for most images.
  // 5 = No speedup. Just uses imagecopyresampled, no advantage over imagecopyresampled.

  if (empty($src_image) || empty($dst_image) || $quality <= 0) { return false; }
  if ($quality < 5 && (($dst_w * $quality) < $src_w || ($dst_h * $quality) < $src_h)) {
    $temp = imagecreatetruecolor ($dst_w * $quality + 1, $dst_h * $quality + 1);
    imagecopyresized ($temp, $src_image, 0, 0, $src_x, $src_y, $dst_w * $quality + 1, $dst_h * $quality + 1, $src_w, $src_h);
    imagecopyresampled ($dst_image, $temp, $dst_x, $dst_y, 0, 0, $dst_w, $dst_h, $dst_w * $quality, $dst_h * $quality);
    imagedestroy ($temp);
  } else imagecopyresampled ($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
  return true;
}
and change:

Code: Select all

imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $w, $h, $width, $height);
to

Code: Select all

fastimagecopyresampled($image_resized, $image, 0, 0, 0, 0, $w, $h, $width, $height);
but the image is still a little blocky so we change this line in detail_view.tpl and cover_view.tpl

Code: Select all

<img src='$TEMPLATEDIR/images/resize.php?img=$UNIXDIR$COVERSDIR$MOVIE[PICTURENAME]&w=75' alt='$MOVIE[FORMATTEDTITLE]' title='$MOVIE[FORMATTEDTITLE]' />
to

Code: Select all

<img src='$TEMPLATEDIR/images/resize.php?img=$UNIXDIR$COVERSDIR$MOVIE[PICTURENAME]&w=75&h=110' alt='$MOVIE[FORMATTEDTITLE]' title='$MOVIE[FORMATTEDTITLE]' />
to add the height parameter since else the picture would have been stretched to 110px in the browser as set in the css file
Last edited by azer on 2008-08-28 17:59:48, edited 1 time in total.
axelv
Posts: 19
Joined: 2008-04-08 22:28:18

Post by axelv »

axelv wrote:I haven't that line! :hum:
But I add it and the problem is solved.

Now, what can I do for delete the black corner as I show you in the image??
No one can hel me??
axelv
Posts: 19
Joined: 2008-04-08 22:28:18

Post by axelv »

axelv wrote:I haven't that line! :hum:
But I add it and the problem is solved.

Now, what can I do for delete the black corner as I show you in the image??
No one can help me??
Post Reply