Gossamer Forum
Home : Products : Links 2.0 : Customization :

I started to make a new mod :) But I've problems

Quote Reply
I started to make a new mod :) But I've problems
Hi all,

i tried to make a new mod Smile It works like this:
If a user adds a new link he can also add a link to an image which describes the link.
that was no problem to do.
I added a new field in links.def
Code:
'Image URL' => [15, 'alpha', 40, 75, 0, 'http://', '^http|news|mailto|ftp'],
but now I want to implement, thatthe script detects whether this image really exists - and if not that it enters a url of an image which can be defined as the standart image.
I've no idea how to test the image and where to make this if image exist...
else use alternate image.
Any ideas ?
Would be really cool Smile
cya,

Nikolai

P.S. When this works I also want to add this image to the html in admin so that you can see the image when you modify a link. But where should i add this ? I found something like:
&build_html_record_form at the end of admin_html.pl but I cannot find the
sub build_html_record_form.
There it should be possible to implement the image shouldn't it ?
Quote Reply
Re: I started to make a new mod :) But I've problems In reply to
Use LWP:Simple or Sockets to detech the Image. Look at the LWP Checker in the Resource Center as a reference and the Spider Mod, which uses Sockets.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: I started to make a new mod :) But I've problems In reply to
I did this a long long time ago, can't remember and I am also not good at perl. See if you get an idea.

Is it not similar to the logo mod in the resource center? Also, since you have already added the field it should be easy to manipulate this in the templates (if you are using templates) by if and if not. You can also do the same in site_html_templates.pl

[This message has been edited by socrates (edited March 04, 2000).]
Quote Reply
Re: I started to make a new mod :) But I've problems In reply to
Huh Smile

not quite easy Smile
Socrates I found your image script but I would like to have it a little different.
When a user submits a link he can also submit an image. Befor adding datas to the database, the script shoulc test whether the user has written something into the image field or not - if not the script should write a standart 'image_not_avaiable.gif' into the database and if he had the script should test whether the image is gif or jpg (nothing else is allowed) and whether the image really exists.
I'really have no idea how to do this Smile
Then in the categories I want to use this 'site of the day/week/month' and also display the image of sodt Smile
I tried to modify this mod which detects whether a given url is correct but i got too many errors.
Any ideas ?
cya,

Nikolai
Quote Reply
Re: I started to make a new mod :) But I've problems In reply to
These issues (testing file existence, checking file extension) will be MUCH easier to resolve if the image files are on your server... also, it will potentially significantly reduce load on your server since the check would only have to be done on link adds/modications, as opposed to each viewing and/or rebuild. Just my $0.02...

------------------
The Immuatable Order of Modding
-=-=-=-=-=-=-=-
1. Read the FAQ, 2. Search the board, 2a. Search the board again, 3. ask the question, 4. back-up, 5. experiment, 6. rephrase question (or better yet, post solution to original question)

Quote Reply
Re: I started to make a new mod :) But I've problems In reply to
Hey oldmoney,

you're right... It's better and easier to keep the images on my own server.
But then I've a new problem Smile
I want to build up a music index and when a visitor posts a link the script should try to add an image to the link (Hehe - my english is so bad that I can not explain what I mean Smile)
So when the posted link is called for example "History of Tango" the script should detect the word Tango and add the Tango image which was defined for Tango to the datas of "History Of Tango" Then when there's a link called "Jazz Standarts" The link should get an image which stands for all jazz related things. Know what I mean ?
My Perl knowledge are so basicaly that I really have absolutely no idea how to solve this problem.
Maybe you can tell me where I've to have a look. Maybe there's a mod which works nearly the same and I can see how this works to try to make it with my mod...
Thanks a lot for help.
cya,

Nikolai