rejetto forum

Creating image icon code

Guest · 10 · 6432

0 Members and 1 Guest are viewing this topic.

Kevin

  • Guest
Ok, I've ran into a slight problem with the program HFS (HTTP File Server)
I wanted something to host my images so only I could view them without the need to upload to somewhere online and deal with the compression.

The only problem is this:
I can see the file names but not preview icon next to it.


It is coded like so, this global.

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


Which produces this href in the attachment


I would like to be able to add a small 80X80 or larger icon to the left of the link if at all possible. I would gratefully appreciate any help or insight.
If any more information is required from me please let me know.

Thanks in advanced!






Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Hi !

<IMG alt="" src="/your_image.png">


Or more generally.
With such code:

{.switch|%item-ext%|,|jpg,gif,png,ico,bmp
       |<table><img class="border_b" src="%item-url%" width="80" height="80" border="2"><a href="%item-url%" target="_blank"></a>
|.}
----------------------------------------------------------------------------------------------------
{.switch|%item-ext%|,|jpg,gif,png,ico,bmp|</tr></table>
|.}

Well placed, it displays all the images in the folder.
« Last Edit: December 23, 2008, 09:17:12 AM by SilentPliz »


Kevin

  • Guest
Where would I place that code in the line. I don't want to have to do that for each photo how can i globally implement it?


Kevin

  • Guest
Thank you that does work but considering my photos are 4.5-6MB a peice is there a way to get the icons to be resized versions not a shrunken full file size version?

Plus it gave me odd code everywhere when I went into folders and was all centered.

Here is my code

Code: [Select]
[protected]
<img src='/~img_lock'>

[file]
{.switch|%item-ext%|,|jpg,gif,png,ico,bmp
       |<table><img class="border_b" src="%item-url%" width="80" height="80" border="2"><a href="%item-url%" target="_blank"></a>
|.}

[folder]
<tr><td>%new% %protected% <a href="%item-url%"><img src="/~img_folder" /> <b>%item-name%</b></a>%comment%<td align=center><i>folder</i><td align=right>%item-modified%<td align=right>%item-dl-count%


Kevin

  • Guest
Ok, fixed the code scramble everywhere.

Code: [Select]
<tr><td>%new% %protected% [b]<img class="border_b" src="%item-url%" width="80" height="80" border="2">[/b]<a href="%item-url%" target="_blank"></a>%comment%<td align=right>%item-size%<td align=right>%item-modified%<td align=right>%item-dl-count%
Still would love it to load low rez version.





Kevin

  • Guest
Ok, now there is a slight issue involving adding folders containing files. Since they are not images there is no preview or link to open them.

Now if I add another folder via the HFS program itself not to the picture DIR would that fix the issue?


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
For thumbnails, this tool seems good:

http://www.rejetto.com/forum/index.php?topic=6280.0

For problem that you indicate, look on my templates.
You understand better.
« Last Edit: December 24, 2008, 09:55:17 AM by SilentPliz »


Kevin

  • Guest
Thanks for the thumbnail link. Looks great, I just can't run it under Ubuntu :( I'm running HFS through wine and it works fine but that program won't launch.
Could you direct me to your template... or is it the code posted above. TO be completely honest if it is I'm confused about placement. I took your code and implemented it into my template fairly easily.

Taking:
{.switch|%item-ext%|,|jpg,gif,png,ico,bmp
       |<table><img class="border_b" src="%item-url%" width="80" height="80" border="2"><a href="%item-url%" target="_blank"></a>
|.}

And making it

[file]
<tr><td>%new% %protected% <a href="%item-url%" target="_blank"><img class="border_b" src="%item-url%" width="80" height="80" border="2"></a>%comment%<td align=right>%item-size%<td align=right>%item-modified%<td align=right>%item-dl-count%

Which works perfectly and looks great.

I with I could run that thumbnail app and also implement the file viewer/link code of yours that I'm confused on what it is and how to add it.


Offline SilentPliz

  • Operator
  • Tireless poster
  • *****
    • Posts: 1298
  • ....... chut ! shh!
    • View Profile
Links to my templates are at the bottom of my message before.  ;)

   
Otherwise, I think that F-Spot in ubuntu makes thumbnails ... but I'm not sure.



EDIT:
Script for Ubuntu (thumbnails) ( not tested )

Code: [Select]
#!/bin/bash

# saving IFS
saveifs=$IFS

# changing IFS (for spaces in names)
IFS="
"

# verifying usage
if [ $# = 0 ]; then
    echo Usage : $(basename $0) image [ image ... ]
    echo Used to generate thumbnails of a list of images.
    exit 1
fi

if [ $1 = -h -o $1 = --help ]; then
    echo Usage : $(basename $0) image [ image ... ]
    echo Used to generate thumbnails of a list of images.
    exit 1
fi

# loop that enables the treatment of a list of images
for i in $*; do
    # verifying file
    if [ -f $i ]; then
        # get image size
        sizeh=$(du -h --apparent-size $i | awk -F" " '{print $1}')

        # get image type
        itype=$(identify -format "%m" $i)

        # get image resolution
        resolution=$(identify -format "%wx%h" $i)

        # get image name, without extension
        name=$(identify -format "%t" $i)

        # get extension
        extension=$(identify -format "%e" $i)

        # resize image and add infos
        convert $i -resize 400x200 -gravity South -background Black -fill white -splice 0x18 -draw "text 0,2 '$itype : $resolution - $sizeh'" $name-thumb.$extension
    else
        echo $i : file does not exist
    fi
done

# restauring IFS
IFS=$saveifs
« Last Edit: December 23, 2008, 10:42:09 AM by SilentPliz »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13523
    • View Profile
on Windows there are hundreds softwares to make thumbnails, i'm sure there are at least 10 on linux. google! ;)