How fill IMG src with JavaScript?

Jalpari

New Member
I have this function in \[code\]PHP\[/code\], which came in a project that I' working:\[code\] foreach ($reports["included_reports"] as $index => $report_name ) { if (! in_array( $report_name, $reports["excluded_reports"])) { $optional_reports .= "<div class=\"large-12 columns\"> <div class=\"panel\"> <a href=http://stackoverflow.com/"./graph_all_periods.php?$graph_args&g=". $report_name ."&height=???&width=???\"> <img BORDER=0 style=\"padding:2px;\" $additional_cluster_img_html_args title=\"$cluster_url\" SRC=http://stackoverflow.com/"./graph.php?$graph_args&g=". $report_name ."&height=???&width=???\" > </a> </div> </div>"; } }\[/code\]I would like to resize the image to fill my div, but I cannot use \[code\]width:100%\[/code\] 'cause I have to inform the \[code\]width\[/code\] and \[code\]height\[/code\] to PHP. But PHP is executed first and I can't know the resolution of user monitor either. Searching in Google I found out I only can know the user monitor resolution via JavaScipt.So I wonder if is possible to do something that I can know the user monitor and inform to my \[code\]width\[/code\] and \[code\]heigh\[/code\] parameters in \[code\]img\[/code\] tag.
 
Back
Top