Show book cover

A place to discuss and receive support for the Library DB application.

Postby dclijste » Sun Aug 19, 2007 4:12 pm

I see that it is possible in some way to add a cover to your book record. However, where and how can i add such a cover? I'm used to work in php but don't have any experience in the code presented here.

since my covers are all called isbn.jpg it's easy to bypass mysql and just ask for the isbn from this specific record and add .jpg at the end. However, where and how can I show a certain field from the specifik form I'm watching.

I also have thumbnails for the view:browse. However, if I have an answer on previous question i'll figure this out myself.
dclijste
 
Posts: 11
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Mon Aug 20, 2007 10:15 am

Hi,

I originally had a book cover feature but removed it because the people who were going to be using it at first, didn't want it.Ê If you have all of the book covers in an easy form as you say, then it wouldn't be too hard to re-add this.Ê The easiest way is to probably add a column to the books table for the cover art.Ê Then implement an htmlValue method in books delegate class (tables/books/books.php) for the column to make sure that it is displayed as an image.

You'll notice remnants of the old columns named cover_art_url_large, cover_art_url_medium, and cover_art_url_small that are already in the fields.ini file and the books.php file.

To make life easier, you may want to just name your field cover_art_url_large so that it will pick up the existing settings.Ê Then you should be able to do one big SQL query on the database to populate that field with the correct cover art url values.


You can alter the cover_art_url_large__htmlValue() method as required to make the output how you like.
-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dclijste » Mon Aug 20, 2007 4:04 pm

I made it myself easy and added the following line on the place of the missing_logo.gif in Dataface_View_Record.html

val('isbn')}.jpeg" style="max-width:180px"/>

All I needed was $record->val($var) since my covers are all isbn.jpeg

It's not a clean code since only me (and other administrators) can add covers (ftp) and there is no replace image, however, my aim is to add a cover for every book so this is more a push for me to be sure I'll find a cover (by now it's only about 300-400 books).

I see dataface supports uploading files and so on but this line is more than enough for my small library.

Thanks for your fast reply !

Denis
dclijste
 
Posts: 11
Joined: Wed Dec 31, 1969 5:00 pm

Postby dclijste » Wed Aug 22, 2007 4:56 am

After experimenting more with dataface I really start loving this application.

So I added widget:type = file to be able to upload files trough dataface.
However, there I found a bug (I think).

I did everyting which is written here:
http://framework.weblite.ca/documentation/how-to/how-to-handle-file-uploads

This didn't work (it handled it just as if it was a blob, and by taking the blob-way i couldn"t upload because it asked for required field cover_mimetype and cover_filetype) untill I changed the name from cover to PDFOutline
This is not a big problem since nobody knows the table name, but it's a weird big ( ? ).
dclijste
 
Posts: 11
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Aug 22, 2007 9:09 am

I replied to the comment on that you left on that tutorial page. There is no bug, though. Yoiiur problem was that you specified the 'Type' parameter in the fields.ini file as 'type'. It needs to be 'Type' and not 'type'.

Case sensitivity...

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby dclijste » Thu Aug 23, 2007 2:21 am

thanks,
I think I have to but 'case sensitive' on a post-it so i'll never forget that. This is not the first time I've lost valuable time because the lack of use of the shift-button :)
dclijste
 
Posts: 11
Joined: Wed Dec 31, 1969 5:00 pm


Return to Library DB Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved