Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
showing an image instead of printing the path
Old 03-14-2005, 06:37 AM showing an image instead of printing the path
Junior Talker

Posts: 2
Trades: 0
I am bulding a site where users can click on links to download information about our software. When they click on a link it takes them to a page where they enter contact infor, press submit, and get the file, all using php.

When you click through it prints the filename you are downloading using php. There are a variety of file types - pps, pdf and html. My boss would like the pdf icon to appear when you download a pdf.

at the minute where this appears I have the following code:

<?php echo $file ?>
<?php if (preg_match('/\.pdf$/i', $file)) {show_source ("http://www.codestone.net/gfx/adobePDF.gif");} ?>



this is working in as much as when it is a pdf file, the image's path is printed, but I do not know what command to use to make it actually show the image instead of showing it's path.

What should I write instead of 'PRINT' to show the image?

thanks for any tips x
pagetta is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-14-2005, 08:22 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
use PHP to assemble an <IMG> tag with the pathname within it.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-14-2005, 09:06 AM
cjdesign's Avatar
Average Talker

Posts: 15
Location: England
Trades: 0
<?php echo "<img src=\"".$file."\" border=\"0\">"; ?>
<?php if (preg_match('/\.pdf$/i', $file)) {show_source ("http://www.codestone.net/gfx/adobePDF.gif");} ?>

Is that what you mean?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
cjdesign is offline
Reply With Quote
View Public Profile Visit cjdesign's homepage!
 
Old 03-14-2005, 09:13 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Errr.. doesn't that put the .pdf into the img tag?
You need to get the .gif file into an img tag if you want it to show up in the browser. What are you using show_source() for in this case?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 03-14-2005, 09:26 AM
cjdesign's Avatar
Average Talker

Posts: 15
Location: England
Trades: 0
Thats what I thought - what are you trying to achieve with your code? "if the file name has ".pdf" in it, view the source of the adobePDF.gif?"

Can't understand why your using show_source()...
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
cjdesign is offline
Reply With Quote
View Public Profile Visit cjdesign's homepage!
 
Old 03-14-2005, 09:40 AM
Junior Talker

Posts: 2
Trades: 0
Thanks for your help guys it turned out to be a really silly error I made,

I actually made a mistake with my first post - I tried show_source and it didn't work at all, and I went back to trying print instead but pasted the wrong code in my post!

any how, I just needed to put it as an image tag like so:

{print ("<img src=http://www.codestone.net/gfx/adobePDF.gif>");}

thanks for your replies though!
pagetta is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to showing an image instead of printing the path
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.29991 seconds with 12 queries