Gossamer Forum
Quote Reply
displaying Thumbnail
Dear All,

I need to display Thumbnail on index.html so i insert:

<%if Thumbnail%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Thumbnail">

<%endif%>

... and on the detail page i insert:

<%if Photo%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Photo" width="100">

<%endif%>

What if Thumbnail is not available and in this case i would like to display the photo with max 100:

<%if Photo%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Photo" width="100">

<%endif%>

So how to say if Thumbnail available display it if not display the photo???

Can someone help me!

Thanks

AntoineBlush

Quote Reply
Re: [antoined] displaying Thumbnail In reply to
Something like;

<%if Thumbnail%>
do this
<%elsif Photo%>
do this
<%else%>
something to do if neither are available...
<%endif%>

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] displaying Thumbnail In reply to
Thank you Andy for replying,

I tried the following but still displaying only Photo on index.html, when i also uploaded Thumbnail.

<%if Thumbnail%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Thumbnail">

<%elsif Photo%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Photo" width="100">

<%else%>

<%endif%>


What missing, any suggestion!

Thanks

Antoine






Quote Reply
Re: [antoined] displaying Thumbnail In reply to
Mmm...try;

<%if Thumbnail%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Thumbnail">

<%else%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Photo" width="100">

<%endif%>

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] displaying Thumbnail In reply to
Thank you it works

Best Regards

Antoine
Quote Reply
Re: [antoined] displaying Thumbnail In reply to
Are you sure it works?
IMHO, Thumbnail tag is not passed to the template so will always give false result.
It's even doubtful, that the 'v' URL parameter is available in the template, since URL redirect is done.

Try this:
<%if Thumbnail%>If you see this 'Thumbnail' tag, works. This is Thumbnail: <%Thumbnail%><%endif%>
If it displays anything then it will work, otherwise not.

Also try this:
<%if v%>If you see this 'v' tag, works. This is 'v': <%v%><%endif%>

I did not checked the core codes, but I'm almost sure that both above will fail to display. Correct me if I'm wrong.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Sorry for the long delay, I am using the following and it is working perfectly:

<%if Thumbnail%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Thumbnail">

<%else%><img src="<%db_cgi_url%>/jump.cgi?ID=<%ID%>&v=Photo" width="120">

<%endif%>

Thanks

Antoine

ps: is it possible to convert a Photo to Thumbnail directly online (ImageMagick module?) in order to avoid submitting the same photo twice with different sizes?

Quote Reply
Re: [antoined] displaying Thumbnail In reply to
Uh, I just see how silly thing I wrote one in my earlier post. Blush
Of course template code suggested by Andy should work. I must be tired that day, sorry. Angelic

Quote:
is it possible to convert a Photo to Thumbnail directly online (ImageMagick module?) in order to avoid submitting the same photo twice with different sizes?
Yes, as long you have ImageMagick installed, yes, you can.
You may also install Image::Magick::Thumbnail perl module for that task.
Also there is an Image::GD::Thumbnail perl module in case if you want to use GD module for that task.

IMHO ImageMagick is better than GD (GD has no GIF support in the latest module versions). So I recommend ImageMagick.

P.S.: Image::Magick::Thumbnail module works, but note, that it even doesn't have any error checking, so keep your eyes open.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 5, 2003, 6:59 AM
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Thank you '33 for this,

I don't have ImageMagick installed on my server, and I don't know if my server could handle such software.

I need to resolve this problem and I am wondering if you can me a quotation to do so (for ImageMagick or IMHO ImageMagick, depends on your best recommendations).

You can send me a private message if you are interested.

Thank you again

Antoine


Quote Reply
Re: [antoined] displaying Thumbnail In reply to
I'm not handling installs, but there may be several people, who may do it for you.

Otherwise it's not difficult, and there are good install docs for every operating systems...
http://www.imagemagick.org/www/INSTALL-unix.html
http://www.imagemagick.org/...INSTALL-windows.html
http://www.imagemagick.org/www/archives.html

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [antoined] displaying Thumbnail In reply to
Hi,

If you want ImageMagick installing let me know via pm.
Quote Reply
Re: [antoined] displaying Thumbnail In reply to
netpbm is a much lighter, much easier to install set of utilities. it's available from http://sourceforge.net

I'm trying to repackage my image routines into a lightweight thumbnailer to work with the logo package. I use netpbm because it is much ligher weight, and you can install it in your user directory if you have to.

I have had a few demos on-line, but with all my crashes I don't have a "final" version anywhere, and that's what I'm trying to package into something easy to install.

Give this a try:

http://betterbeads.com/...QL/test_upload_2.cgi

If I can just get it hooked up with the logo upload again, I can get it released :(


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] displaying Thumbnail In reply to
However netpbm doesn't have any Perl interface or module, so you have to use system calls...

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
As long as you know what you are passing, there is nothing wrong with that.

Everything is hard coded, except the filename, but you construct that, and do not pass _ANY_ input other than what you've constructed.

Image Magick will not compile on all systems, and the overhead is staggering.

I tried using Image Magick on several systems, but gave up. Different hardware, software, and OS versions.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] displaying Thumbnail In reply to
Using backtick operator (and in some cases system calls, too), causes the performance decrease.
Therefore I avoid using external commands if possible...

Quote:
Image Magick will not compile on all systems
On which system did you have problem?
BTW: there are many compiled binary, so why you didn't use the binary version?
ftp://ftp.imagemagick.net/...mageMagick/binaries/

I had no problem installing Image Magick on Windows. Works fine.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Quote:
Using backtick operator (and in some cases system calls, too),

Backticks and system calls are the same thing Wink
Quote Reply
Re: [Paul] displaying Thumbnail In reply to
Quote:
Backticks and system calls are the same thing
Paul, you are wrong, if you think backticks and system calls are the same things...
You should read more docs.

perlfaq8 - Why can't I get the output of a command with system?
"You're confusing the purpose of system() and backticks (``). system() runs a command and returns exit status information (as a 16 bit value: the low 7 bits are the signal the process died from, if any, and the high 8 bits are the actual exit value). Backticks (``) run a command and return what it sent to STDOUT."

perlfaq8 - What's wrong with using backticks in a void context?
"Backticks are one; they collect the output from the command for use in your program. The system function is another; it doesn't do this."

perlfaq8 - What's wrong with using backticks in a void context?
"And now they think ``Hey, I'll just always use backticks to run programs.'' Bad idea: backticks are for capturing a program's output; the system function is for running programs."

System compatiblity:
ActivePerl-Winfaq5
"* system() or backtick (``) calls to system tools that aren't available on ActivePerl."

Finally about performance issues, if somebody use mod_perl (!):
Spawning a Detachable Sub-Process
"Just like with fork(), using the system call system() defeats the whole idea behind mod_perl. The Perl interpreter and modules would be loaded again for this external program to run if it's a Perl program. Remember that the backticks (`program`) and qx(program) variants of system() behave in the same way."

Efficiency in Perl
"CGI scripts, such as the ones using system() (which also reduces portability) or `backtick` notation are inefficient by their very nature, and very resource-intensive. There are ways to reduce or eliminate all these overheads, but these tend to be operating system- or server-specific (for which the best support seems to be in Apache)."


P.S.: Sorry, my post seems offtopic, it's not related to "displaying Thumbnail" in any way :(

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...

Last edited by:

webmaster33: May 9, 2003, 3:50 PM
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Despite all this -- my assumption is the fact that these calls are done ONCE and RARELY, upon upload, new links, etc.

It is not for a "real time" system.

If it were, the programs would _HAVE_ to be in C/C++ and run with mod_perl compatibitly, more likely on their _OWN_ machine.

Again, if I was going to set up a dedicated system, it's one thing.

Since I'm building a plugin for Links SQL, that needs to run on many different systems, that may or may not have the ability to run or compile programs like Image Magick it's sort of digressing to enter that area.

Since only "calls" are made, if someone wanted to run image magick with this program, it would mean editing one set of routines, one "file" (the Process.pm" file).

It would be up to them to pass the correct values into the routines, and return the correct values to the main program.

The point is _NONE_ of these solutions is a real-time solution for a busy site.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Quote:
Paul, you are wrong, if you think backticks and system calls are the same things...
You should read more docs.

I'm fairly comfortable that what I said was accurate. I don't see any part of your cut and paste from perldoc that disproves my comment. The return values differ when using qx// and system(), but they still both perform a system call.

Guess you know best though right? Wink
Quote Reply
Re: [Paul] displaying Thumbnail In reply to
I was quite sure, you will not change your mind. Wink
Since it's offtopic anyway, there is no reason to continue the disussion.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...
Quote Reply
Re: [webmaster33] displaying Thumbnail In reply to
Correct =)