Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output images to the web

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hi,
I had difficulty trying to ouput images from the database and place it on the webpage. I have selected hyperlink as the data type. All I've got was broken links for the images.I would like to know how do I do it.
I need help urgently.
 
I would suggest storing the path to the image in the database as a text field. images/image1.jpg then call the path <img src=&quot;#image#&quot;>.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
I would suggest storing the image name only in the database as the path itself can be changed; you can define the image folder in the application.cfm and store it in the application scope:


<!--- application.cfm --->
<cflock scope=&quot;application&quot; timeout=&quot;30&quot; throwontimeout=&quot;Yes&quot; type=&quot;exclusive&quot;>
<cfscript>
application.stApplicationData = StructNew();
StructInsert(application.stApplicationData, &quot;root&quot;, GetDirectoryFromPath(GetCurrentTemplatePath()));
</cfscript>
</cflock>

<cflock scope=&quot;application&quot; timeout=&quot;30&quot; throwontimeout=&quot;Yes&quot; type=&quot;readonly&quot;>
<cfloop collection=&quot;#application.stApplicationData#&quot; item=&quot;i&quot;>
<cfscript>
&quot;request.#i#&quot; = application.stApplicationData[&quot;#i#&quot;];
</cfscript>
</cfloop>
</cflock>


<!--- any template you use image --->
<img src=&quot;#request.root#/#image#&quot;>
Sylvano
dsylvano@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top