insert into imagesi ( item_id, revision_id, title, description, context_id, creation_user, creation_ip ) values ( :item_id, :revision_id,:title, :description, :term_item_id, :user_id, :peeraddr ) update images set width =:original_width, height = :original_height where image_id = :revision_id update cr_items set live_revision = :revision_id, name = :name, publish_status = 'live' where item_id = :item_id insert into images( image_id ) values ( :new_revision_id ) update images set width =:original_width, height = :original_height where image_id = :new_revision_id update cr_items set live_revision = :new_revision_id, name = :name, publish_status = 'live' where item_id = :new_item_id insert into cr_child_rels ( rel_id, parent_id, child_id, relation_tag ) values ( :rel_id, :term_item_id, :new_item_id, 'illustration' )