javascript - How come my image is not displayed in the pop up window? -
i'm newbie coldfushion. i'm trying create page user can view small pictures. once clicks on picture, image show in new pop window. i'm not sure what's missing in code, when click on small picture, new window pop up..there's no image in new pop window set image path. can give me suggestions on how fix this? lot!
edit: followed suggestion , made changes code. however, still not working. can tell me i'm missing? thanks!
in full_article_view.cfm:
<!--- retrieve full article images ---> <cfquery name="myquery1" datasource="mydb" > select articles.article_id, articles.article_title, articles.article_author, articles.article_date, articles.article_content articles inner join article_image_mapping on articles.article_id = article_image_mapping.aim_articleid articles.article_id = #url.id# group article_image_mapping.aim_articleid </cfquery> <cfquery name="myquery2" datasource="mydb" > select images.image_id, images.image_thumbpath, images.image_fullpath images inner join article_image_mapping on images.image_id = article_image_mapping.aim_imageid article_image_mapping.aim_articleid = #url.id# </cfquery> <!doctype html> <html> <head> <title>hi</title> <meta charset="utf-8"> </head> <body> <!--- page title ---> <h3>full article view</h3> <!--- page content ---> <div align="left"> <!--- display article title, author, date, , full content ---> <cfoutput query="myquery1"> <b>#ucase(myquery1.article_title)#</b> <hr> <p style="color:##848181; font-size:12px">#myquery1.article_author# :: #myquery1.article_date#</p> #myquery1.article_content#<br/> </cfoutput> <br> <!--- display images associated article---> <cfoutput query= "myquery2"> <img src="#myquery2.image_thumbpath#" alt="image thumbnail" onclick="coldfusion.window.create('window1', 'this cf window', 'full_img.cfm?toshow=#myquery2.image_fullpath#', {x:100,y:100,height:300,width:400,modal:false,closable:true, draggable:true,resizable:true,center:true,initshow:true, minheight:200,minwidth:200})"> </cfoutput> </div> </body> </html>
in full_img.cfm:
<cfparam name="url.toshow" default=""> <cfoutput> <img src="#url.toshow#" alt="full image"> </cfoutput>
the reason fails because cfwindow expects url loaded return text, not binary data. when said third arg coldfusion.window.create image source, tried load binary image data window contents, not work.
there simple enough workaround. build new cfm called, well, whatever want, code so:
<cfparam name="url.toshow" default=""> <cfoutput> <img src="#url.toshow#"> </cfoutput>
this cfm takes in url parameter image , renders html load it. modify original code use new url:
onclick="coldfusion.window.create('window1', 'this cf window', 'test3.cfm?toshow=#urlencodedformat(iurl)#',
in example above, test3.cfm test file.
and yes - stop using cf ui stuff too. ;)
Comments
Post a Comment