publish::handle::image (public)

 publish::handle::image item_id [ args... ]

Defined in packages/acs-content-repository/tcl/publish-procs.tcl

The basic image handler. Writes the image blob to the filesystem, then either merges with the template or provides a default <img> tag. Uses the title for alt text if no alt text is specified externally.

Parameters:
item_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 db_1row db_1row (public) publish::handle_binary_file publish::handle_binary_file (public) publish::html_args publish::html_args (private) template::util::get_opts template::util::get_opts (public) template::util::is_nil template::util::is_nil (public) publish::handle::image publish::handle::image publish::handle::image->db_1row publish::handle::image->publish::handle_binary_file publish::handle::image->publish::html_args publish::handle::image->template::util::get_opts publish::handle::image->template::util::is_nil

Testcases:
No testcase defined.
Source code:
  template::util::get_opts $args

  # LARS TODO: Added -no_merge, verify how this is supposed to work
  set html [publish::handle_binary_file  $item_id revision_id url error_msg {*}$args -no_merge]

  # If an error happened, abort
  if { ![template::util::is_nil error_msg] } {
    ns_log Warning "publish::handle::image: WARNING: $error_msg"
    return ""
  }

  # Return the HTML if we have any
  if { ![template::util::is_nil html] } {
    return $html
  }

  # If the merging failed, output a straight <img> tag
  db_1row i_get_image_info ""

  # Concatenate all the extra html arguments into a string
  if { [info exists opts(html)] } {
    set extra_html [publish::html_args $opts(html)]
    set have_alt [expr {"alt" in [string tolower $opts(html)]}]
  } else {
    set extra_html ""
    set have_alt 0
  }

  set html "<img src=\"$url\""

  if { ![template::util::is_nil width] } {
    append html " width=\"$width\""
  }

  if { ![template::util::is_nil height] } {
    append html " height=\"$height\""
  }

  append html $extra_html"

  # Append the alt text if needed
  if { !$have_alt } {
    append html " alt=\"$image_alt\""
  }

  append html ">"

  return $html
Generic XQL file:
<fullquery name="publish::handle::image.i_get_image_info">
    <querytext>
      
    select 
      im.width, im.height, r.title as image_alt
    from 
      images im, cr_revisions r
    where 
      im.image_id = :revision_id
    and
      r.revision_id = :revision_id
  
      </querytext>
</fullquery>
packages/acs-content-repository/tcl/publish-procs.xql

PostgreSQL XQL file:
packages/acs-content-repository/tcl/publish-procs-postgresql.xql

Oracle XQL file:
packages/acs-content-repository/tcl/publish-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: