  def delete_image
    Log.add_info(request, params.inspect)

    return unless request.post?

    begin
      image = Image.find(params[:image_id])

      @item = Item.find(image.item_id)

      unless @item.check_user_auth(@login_user, 'w', true)
        raise t('msg.need_to_be_owner')
      end

      image.destroy

      @item.update_attribute(:updated_at, Time.now)

    rescue => evar
      Log.add_error(request, evar)
    end

    render(:partial => 'ajax_item_image', :layout => false)
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.