Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
GiGi05 #1
CFContent Problem - Passing parameters in URL with imgsrc tag
Hi All,
My code is like this on the ViewImage.cfm page
<img src="GetImage.cfm?id=123">
on the GetImage.cfm page
<cfcontent type="image/gif" file="images/logo.gif" deletefile="No">
First, can someone show me how to get the id parameter from the ViewImage.cfm
page?
Second, even when i took off the parameter tag on the ViewImage.cfm page, the
image is not loading at all.
Please help!!!
Thanks a million......
GiGi05 Guest
-
CFContent and passing mp3s to flash
Ok, I've been trying to use FLASH as an mp3 player (to help over come illigal downloads/saving) but my issue arrises in that (a) I need to pass the... -
Problem passing parameters usign DynaLib
Hi, I want to call functions that I have in dynamic library (written in C) from a perl program. I'll try it using the module DynaLib but I´m... -
Passing Parameters into NEW()
Is there any way that the NEW() of a web service can accept parameters ? I would like to pass a boolean to indicate to the webservice that I am in... -
Help Passing Parameters
Before going to the third script I'd suggest storing the variables in session variables. Here's how I generally do login scripts. Perhaps have... -
ampersand problem when passing multiple parameters in URL
Hi, when I try to pass some parameters in an URL, I always get an URL where the ampersand is represented as '&'. I tried: $url =... -
nTesla #2
Re: CFContent Problem - Passing parameters in URL withimg src tag
#URL.id# is the variable from the URL. I would do something like: <cfif (NOT
isDefined('URL.id'))><cflocation url='viewimage.cfm'></cfif> right at the top
of the page. It's important to note the the parameter is not on the
viewimage.cfm page, it's on the getimage.cfm page. You're passing it *from* the
viewimage.cfm page.
nTesla Guest
-
GiGi05 #3
Re: CFContent Problem - Passing parameters in URL withimg src tag
Thanks for the respond!
But the URL parameter in the img src tag. How can i capture that parameter? I have try URL.ID but it doesn't work.
--Gigi05
GiGi05 Guest
-
Kronin555 #4
Re: CFContent Problem - Passing parameters in URL withimg src tag
When the user's browser encounters an img src tag, the browser makes a separate
request to that URL (in this case, GetImage.cfm?id=123). Then, on GetImage.cfm,
URL.id should be defined. Are you trying to go directly to GetImage.cfm to test
it? If so, you need to go to GetImage.cfm?id=123.
If this doesn't answer your question, maybe I'm not understanding what you
mean when you say "How can I capture that parameter?". Are you trying to
capture it on the GetImage.cfm page? That is what I'm assuming.
Kronin555 Guest
-
gwgiswebmaster #5
Re: CFContent Problem - Passing parameters in URL withimg src tag
not sure what you are doing with the URL parameter, but in the cfcontent tag
you also need the entire path to your image (c:\images\...) you can also param
the url on your getimage.cfm page <cfparam name='url.id' default='0'> if you so
choose. I experimented on our server pulling images from a database using this
method and it works like a champ.
gwgiswebmaster Guest
-
GiGi05 #6
Re: CFContent Problem - Passing parameters in URL withimg src tag
on the ViewImage.cfm page
<img src="GetImage.cfm?id=123">
on GetImage.cfm page
<cfparam name="URL.ID" default="" type="string">
<cfquery datasource="#application.DSN#" name="getimage">
select *
from Tbl_Image
where id = #url.id#
</cfquery>
<cfcontent type="image/gif" file="c:/images/#getimage.Name#" deletefile="yes">
when i load the page ViewImage.cfm, nothing happen at all. The image doesn't
load at all. Can you tell me why it doesn't work? I have no clue.....
GiGi05 Guest
-
gwgiswebmaster #7
Re: CFContent Problem - Passing parameters in URL withimg src tag
before I answer this, just confirm whether you are actually storing the image
in your database or just the filename. if its the latter, you may want to try
changing your forward slashes in the file attribute to backslashes first, and
using the Trim() function on your database columnname.
gwgiswebmaster Guest
-
Kronin555 #8
Re: CFContent Problem - Passing parameters in URL withimg src tag
On the GetImage.cfm page, output the image path and name you're passing to
cfcontent and verify that the image actually exists as requested on your server:
<cfparam name="URL.ID" default="" type="string">
<cfquery datasource="#application.DSN#" name="getimage">
select *
from Tbl_Image
where id = #url.id#
</cfquery>
<cfoutput>Image requested: "c:\images\#getImage.Name#"</cfoutput>
Also, change your slashes. Once you've modified GetImage as above, go to it
directly in your browser:
[url]http://yourURL/GetImage.cfm?id=123[/url]
and see what path it is trying to request. Once you get your path issues
figured out, the cfcontent should work fine.
Kronin555 Guest
-
GiGi05 #9
Re: CFContent Problem - Passing parameters in URL withimg src tag
Thanks for all your reponds. They are very helpful. Thanks again!!!!
GiGi05 Guest



Reply With Quote

