regexp {/?([0-9]+)/?([^/]*)?} [ad_conn path_info] match user mode set base [phb::key $user] set priv 0 if {![info exists mode] || [lsearch {base web small thumb} $mode] == -1} { set mode small } set rel portrait_$mode if {[db_0or1row image { select image_revision_id, priv_portrait from phb_portraits where relation_tag = :rel and user_key = :base } ] } { if {($priv || $priv_portrait) && ![permission::permission_p -party_id [ad_conn user_id] -object_id [ad_conn package_id] -privilege admin] } { ns_set update [ad_conn outputheaders] Cache-Control \ "no-cache,max-age=0,must-revalidate,proxy-revalidate" ns_returnfile 200 image/gif "[get_server_root]/packages/photobook/lib/noimage-$mode.gif" } else { ns_set update [ad_conn outputheaders] Cache-Control \ "no-cache,max-age=0,must-revalidate,proxy-revalidate" cr_write_content -revision_id $image_revision_id } } else { ns_set update [ad_conn outputheaders] Expires \ [ns_httptime [ns_time]] ns_set update [ad_conn outputheaders] Cache-Control \ "no-cache,max-age=0,must-revalidate,proxy-revalidate" ns_set update [ad_conn outputheaders] Pragma \ "no-cache" ns_returnfile 200 image/gif "[get_server_root]/packages/photobook/lib/noimage-$mode.gif" }