|
12-08-2003, 07:18 AM | #1 |
Orange Mole
Join Date: Nov 2003
Posts: 69
|
Thumbnail images (only in special cases)
If you are using PhpDig on a site that you have complete control over (e.g. your own site), and if you have or if you can make a thumbnail image for many pages that are indexed, then you might be interested in search results that also show these thumbnail images.
Are you? If so, please tell me in a reply to this thread. I have a little piece of code to get search results with thumbnails on the side and I'll share it if someone is interested.
__________________
René Haentjens, Ghent University |
12-08-2003, 09:08 AM | #2 |
Green Mole
Join Date: Dec 2003
Posts: 4
|
I am curious to see you thumbnail code. Is it a 'picture' of a text file that you are talking about? I am interrested in how GD works, and I would like to see what you have done.
|
12-08-2003, 07:23 PM | #3 |
Former Member
Join Date: Sep 2003
Posts: 34
|
same here
|
12-10-2003, 01:05 AM | #4 | ||
Orange Mole
Join Date: Nov 2003
Posts: 69
|
Bear with me, the code change to show thumbnail images requires a little bit of explanation.
Say you're using PhpDig to index "http://ownsite/". The pages contain links like "http://ownsite/dir/some.html". PhpDig finds these links and indexes the corresponding pages. You also have thumbnail images that represent your HTML pages in some way, for example "some_t.jpg" for "some.html"; you store these thumbnail images in the same directory as the page, so our sample thumbnail is reachable via url "http://ownsite/dir/some_t.jpg". Note that I am not addressing the issue of how to produce "some_t.jpg". I am assuming that it exists. Also, the code below assumes the thumbnail to be in the same directory as the HTML page, but this requirement can be relaxed. If a search finds the HTML page, you want to display the thumbnail. You must indicate in the search template where you want the thumbnail to appear, e.g. by inserting some directive like "<phpdig:thumbnail/>". I am assuming that you have looked at templates and that you understand how they work. On second thoughts, it is nice that people can click on the thumbnail to get to the page. So the thumbnail <IMG> must be included in an <A> element. It so happens that we already have a phpdig template directive to insert a clickable image; if the link must be to the found page, it is of the form: "<phpdig:complete_path src='xxx'/>". Only we cannot put a fixed source, as the source depends on the page that is found. We'll come back to the template directive later. Meanwhile, I'll tell you about the code for the template formatting. That is where you'll have to do a PHP code change. Open libs/function_phpdig_form.php, locate function phpdigParseTags. There is a line: Quote:
Quote:
Now here is the trick that I have used to make this code do what I want it to do: in my "http://ownsite/", the URLs pointing to other pages are not just ordinary URLs but URLs with an extra little tail. For example, you'll find hyperlinks like "<a href='http://ownsite/dir/some.html?thumb=some_t.jpg'>Next page</a>". For clicking from page to page, the "?thumb=xxx" tail is ignored. But when PhpDig comes along, it stores the complete URL, including the "?thumb=xxx" tail, in its database. So, when later a search finds this page, "<phpdig:complete_path/>" will include the tail and the regular expression will find it. The "ereg_replace" then just manufactures an URL for the thumbnail image. One final addition is about the template directive "<phpdig:complete_path src='xxx'/>". It must clearly express that it is used here for thumbnails, not for something else. So for example, we could have " src='thumbnail' " as a special placeholder. (Remember, the thumbnail URL is dynamic, we cannot plug a static one here.) There will be pages that have no thumbnail, i.e. some page URLs in my site will still be like "http://ownsite/dir/some.html" with no "?thumb=xxx" tail. As I now have a template that is longing for inserting a clickable image, I have to provide a "by default" image. This "by default" image will be in my PhpDig directory, not in the indexed site. Say we use "tpl_img/cprgo.gif" as default image. The template directive therefore is not only a special placeholder, but at the same time tells PhpDig which image to use for found pages that have no corresponding thumbnail image. Here is the template directive that I use: <phpdig:complete_path src="nothumb/tpl_img/cprgo.gif"/> The "nothumb/" part tells the above code that this is the special placeholder. Any relative path can be provided after the "nothumb/" part, to point to the default thumbnail image. There, I've said it! I hope you're still with me... The thumbnail trick works, I've tried it out. In the site that I want to index, many pages have a corresponding thumbnail. The above code is still somewhat rigid, it wants the thumbnail image to be alongside the HTML page. This serves my need perfectly. If you want the thumbnails to be somewhere else, no doubt you'll see a way to implement it by adapting the above code somewhat.
__________________
René Haentjens, Ghent University |
||
12-10-2003, 07:39 AM | #5 |
Green Mole
Join Date: Dec 2003
Posts: 4
|
Nice idea. I will have to try that sometime. Thanks for the reply. Do you have a simple way that you use to produce thumbnails for html pages?
|
12-10-2003, 11:19 PM | #6 |
Orange Mole
Join Date: Nov 2003
Posts: 69
|
Manual procedure
Not an automatic one...
Browse to the page, Alt/PrintScreen, open your favorite image tool (mine is IrfanView), paste, crop, resize, save as JPEG: http://zephyr.ugent.be/TW05DBRH/docu...pDigDotNet.jpg The site that I want to index mainly contains digital photos, so I use thumbnails of the photos, not of the web pages...
__________________
René Haentjens, Ghent University |
12-11-2003, 06:19 AM | #7 |
Green Mole
Join Date: Dec 2003
Posts: 4
|
Some of what I would like to index would be for a general document store, and I thought that thumbnails of the front page of an open office, html, or txt page would be neat, but I need to find someway to perform that action with out a printscreen. (I think KDE has something like that now that I think about it.)
What exactualy do you index if you are indexing images? Do you have some type of meta data that gets indexed, or is it just the file name that gets indexed? |
12-11-2003, 10:48 PM | #8 |
Orange Mole
Join Date: Nov 2003
Posts: 69
|
When it's just a directory with images, we add IEEE 1484 type metadata in an XML file.
For teaching purposes, images are often put in PPT presentations, and I am developing a (client-side) script to extract metadata from a PPT file to store it in an XML file.
__________________
René Haentjens, Ghent University |
02-13-2004, 01:10 AM | #9 |
Orange Mole
Join Date: Nov 2003
Posts: 69
|
If you are interested in seeing a small example of a website containing mainly images, send me an e-mail mentioning the institution that you are working for and its website.
PhpDig 1.8.0 has been customized in that website to show thumbnails with the search results. The search window contains a tree structure with keywords that have been used to describe the images. We are also developing tools that facilitate the description of images and presentation slides by keywords etc. These developments are funded by the Flemish Government (Belgium). The website is "hosted" by the eLearning platform Claroline.
__________________
René Haentjens, Ghent University |
05-25-2004, 01:08 PM | #10 |
Green Mole
Join Date: Apr 2004
Location: France
Posts: 1
|
Thumbnail
Hello,
Personnaly, I use the AscreeN technologie for PhpDig. http://moteur.pointdecroix.org/ascreen.php (In french) See also http://www.apocalx.com/ascreen/ |
09-09-2004, 01:13 AM | #11 |
Orange Mole
Join Date: Nov 2003
Posts: 69
|
The little website with images has been updated to PhpDig 1.8.3 and eLearning platform Dokeos 1.5.4, and has been completely reworked behind the scenes.
You can have a look on cordoba.ugent.be/dokeos/VELODLA/ Click on 'Zoeken met PhpDig'. Cordoba is my desktop PC and it is usually up and running monday 9 am thru thursday 5 pm (Brussels time), not on friday, saturday and sunday. With 'Zoeken via metadata' the search is slower, PhpDig is not used then. For more info, e-mail me.
__________________
René Haentjens, Ghent University |
Thread Tools | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Get text from alt and title images attributes? | djuritz | How-to Forum | 0 | 07-14-2006 06:05 AM |
Adding a thumbnail to each page...help? | huge_nerd | How-to Forum | 1 | 11-16-2004 09:54 AM |
site thumbnail | snorkpants | Mod Requests | 0 | 04-25-2004 06:58 AM |
Generate text images on Linux | Charter | Coding & Tutorials | 0 | 03-05-2004 11:37 AM |