rejetto forum

Pictures + Thumbs Preview

Guest · 68 · 49538

0 Members and 1 Guest are viewing this topic.

MusicMan

  • Guest
Pictures + Thumbs Preview

i found some code for that, and modifieded it a bit ...

i have a dir with pictures in it.
then i made thumbs from those pictures 100x100,
and placed them in a dir called "thumb"
when i list the pictures, a thumb is showed from the thumb dir...
this works very well, but................

the only drawback is:
1. when i dont have created the thumbs yet
2. the thumb dir is visible

so anyone knows how solve this:
1. if no thumb(file) exist, show the original picture (some kind of case/if structure)
2. make the thumb dir hidden

ofcource i have alot of picture dirs, and possible thumb dirs

info:
Code: [Select]
%encoded-folder%  =  directory
thumb  =  is thumbdir
%item-name%"  =  filename


Code: [Select]
[file]
<tr><td class=row>%new% <a href="%item-url%">

<script language="javascript">
var c='%item-name%';
switch (  c.substr(  c.lastIndexOf('.')  ) .toLowerCase()  )
   {
case '.jpg' : case '.jpeg' : case '.gif' : case '.png' :case '.ico' :case '.bmp' : document.write('<a href="%item-url%" target="_blank"><img align=middle width="100" height="100" src="%encoded-folder%thumb/%item-name%"> </a> ');break;
   default      : document.write('<img align=middle src="/~img_file"> ');
   }
</script>

 %item-name%</a>%comment%<td class="row right">%item-size%<td class="row right">%item-modified%<td class="row right">%item-dl-count%
</tr>


http://img190.imageshack.us/img190/5139/screenshot0013rh.jpg
http://img166.imageshack.us/img166/5670/screenshot0027sg.jpg
http://img166.imageshack.us/img166/5153/screenshot0030tp.jpg
http://img166.imageshack.us/img166/7698/screenshot0048yo.jpg


Guest

  • Guest
Gave this code a go, AWESOME :) i found just making the file hidden eliminates the thumbs directory from still being there.

The biggest issue with this code is that it runs for ALL files, it would be nifty if someone (maybe you) could figure out a way of makin it run for only image files. This problem may be only a minor detail for high bandwidth users, but for the poor dialup or isdn users trying to access the folder it adds alot of excess source code.


Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile
very nice but would take a little while to do on my server.  Hehe but great find.


Offline ledufe

  • Tireless poster
  • ****
    • Posts: 272
  • LEandro DUpont FErreira
    • View Profile
    • http://ledufe.no-ip.info:2222
Quote from: "Guest"
...The biggest issue with this code is that it runs for ALL files, it would be nifty if someone (maybe you) could figure out a way of makin it run for only image files...


and so, why donĀ“t just add this file section to your template, right just above the section [file] do or create a section called [file.jpg] and do your code to show only the thumbnails, like this:

Code: [Select]
[file]
<tr><td class=row><a href="%item-url%"><img align=top src="/~img_file"> %item-name%</a>%new%<br>%comment%<td class="row right">%item-size%<td class="row right">%item-modified%<td class="row right">%item-dl-count%

[file.jpg]
<tr><td class=row><img align=top src="/~img_file"><a href="%item-url%"><img align=top src="tn-%item-url%"> %item-name%</a>%new%<br>%comment%<td class="row right">%item-size%<td class="row right">%item-modified%<td class="row right">%item-dl-count%


this should work only for jpg files, add some other image file sections to use with only the file types you
<<LeDuFe>>


Guest

  • Guest
Hey its me, the Guest lol, back again just say thanks for the replies, i will give this a go, see if it works i might actually post some screeners of my modified 'black' template later with this in it :).


Guest

  • Guest
Ok i have had a little play around with it and by putting the [file.jpg] it just brings the page up with this folder is empty, so that one doesn seem to work...

But like i said, here is my modded template with the older version of the code included, i made the thumbnails quite small so not to completely pwn my server, but its better than icons :)

http://www.geocities.com/caspersnevets/ImageGallery.jpg
http://www.geocities.com/caspersnevets/IESUX.jpg
http://www.geocities.com/caspersnevets/Home.jpg


Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile

Guest

  • Guest
Thanks moondog! I spent my uni hols practising html on the server.

IF u are wondering i am only on a 512k ADSL connection so my upstream is only about 16kb\s MAX, and having thumbs about that size doesn really have an affect on my bandwidth, they are only about 1kb each thumb...

The IESUX image is a modified version of explorer destroyer, i found my site looks shithouse in IE. But who uses IE anyway ;)


Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile
NP i am currently working looking for another program I think its not bad  i am on a 5 mb connection. I am looking for people to test mine some times as alot of my duddys dont go on to much if you want u can add me to msn at moon_dog23@hotmail.com. we can share ideas and stuff


Offline ledufe

  • Tireless poster
  • ****
    • Posts: 272
  • LEandro DUpont FErreira
    • View Profile
    • http://ledufe.no-ip.info:2222
ops....nobody ask me or even invite me, but i want to sahre some ideas too, and it could be on msn messenger too, i want to know some things and try some others.....
it would be good to have someone else to share it too...
rssrsrsr
by the way, im working on some new template layout, and trying to separate the formating code of the template from the main code.... css and code...do you know what i mean?
<<LeDuFe>>


Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile
ledufe i love looking and chatting about this stuff if u wish  u may add me too i dont mind. At all or if u use other chat programs i can use them too



Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
can this work with this template?
http://www.rejetto.com/forum/index.php?topic=3203.0
all my images show broken

I am unsure why it is not working for you i have mine narrowed down to just work with only jpg's, this is my code below.
[file]
<tr><td class=row style="color:#FF6633; padding:0">%new%<script language="javascript">var c='%item-name%';switch(c.substr(c.lastIndexOf('.')) .toLowerCase()){case'.jpg':document.write('<a href="%item-url%"><img align=absmiddle src="%encoded-folder%thumb/%item-name%"> </a>');break;default:document.write('<img align=top src="/~img_file">');}</script><a href="%item-url%"> %item-name%</a>%comment%<td align=center class=row>%item-size%<td align=center class=row>%item-modified%<td align=center class=row>%item-dl-count%</tr>

Ino its chunky but thats how my whole template source is, trying to reduce as many bytes as possible, i only have a 16kb\s upload  :P

The way mine works is that the file is actually in the directory of the images, and its a hidden file, so hfs cant see it, then yay we have jpg thumbnails.

This is getting long now so i will stop momentarily, i would rather use the hfs [file.jpg] code i have heard of, if that works on 2.1 beta 18 can someone tell me how to do that?  ???

« Last Edit: October 01, 2006, 07:06:43 AM by That_Stevens_Guy »


Offline TSG

  • Operator
  • Tireless poster
  • *****
    • Posts: 1935
    • View Profile
    • RAWR-Designs
The way mine works is that the file is actually in the directory of the images, and its a hidden file, so hfs cant see it, then yay we have jpg thumbnails.

ino i am qouting myself but i have found that since using the 2.1 beta 18 it is counting my thumbnail downloads and racking up the hit counter on the files as it downloads the thumbnails.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13521
    • View Profile
right click on the "thumb" folder
don't count as download: mask
then, enter "*"