xowiki::markdown_image::attach (private)
xowiki::markdown_image::attach page drafts
Defined in packages/xowiki/tcl/markdown-image-procs.tcl
Save each staged image as an attachment owned by this page.
- Parameters:
- page (required)
- drafts (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set object_id [$page item_id] dict for {image_id draft} $drafts { lassign $draft path mime set result [attachments::richtext::file_attach -item_id $image_id -object_id $object_id -import_file $path -mime_type $mime -title "Pasted image.[lindex [split $mime /] 1]" -user_id [ad_conn user_id] -peeraddr [ad_conn peeraddr] -package_id [$page package_id]] if {![dict get $result success]} { error "Could not attach the pasted image." } # FormPage may still be inside an outer transaction. Verify the commit # before discarding the file, so the editor can retry a failed save. ns_atclose [list ::xowiki::markdown_image::discard_attached_draft $object_id $image_id $path] }XQL Not present: Generic, PostgreSQL, Oracle